Ave,
I¹m not sure how to execute this. I can easily write a long, tedious code to
handle each table separately, but I¹m sure there is an Array/For Each way to
do this.
I¹ve got 6 mySQL tables. I¹ve written a code that dumps data from each table
into one corresponding DBF table. While writing to the DBF, I also add a
field & a value to it identifying the table.
I need to dump data from all the mySQL tables into one DBF table, and also
have that added field & identifier value added to each table¹s data.
Here¹s my code to export from 1 mySQL table into 1 DBF table.
($tChoice & $bx are Table Name & Identifier Value that are passed on from a
previous page):
// database "definition"
$def = array(
array("phone","C", 10),
array("comments","C", 254),
array("starttime","C", 10),
array("endtime","C", 10),
array("dispo","C", 80),
array("lo", "C", 50),
array("verifier", "C", 50),
array("branch","C",3)
);
// creation
if (!dbase_create('dbf/'.$bx.'.dbf', $def)) {
echo "<BR><BR>Error, can't create the database<BR><BR>";
}
// open in read-write mode
$db2 = dbase_open("dbf/".$bx.".dbf", 2);
if ($db2) {
mysql_select_db($database_imslead_transfer, $imslead_transfer);
$query_loDispo = "SELECT * FROM $tChoice";
$loDispo = mysql_query($query_loDispo, $imslead_transfer) or
die(mysql_error());
$row_loDispo = mysql_fetch_assoc($loDispo);
$totalRows_loDispo = mysql_num_rows($loDispo);
// write mySql data to Dbf
do {
dbase_add_record($db2, array(
$row_loDispo['phone'],
$row_loDispo['comments'],
$row_loDispo['starttime'],
$row_loDispo['endtime'],
$row_loDispo['dispo'],
$row_loDispo['loanofficer'],
$row_loDispo['verifier'],
$bx));
} while ($row_loDispo = mysql_fetch_assoc($loDispo));
dbase_close($db2);
}
mysql_free_result($loDispo);
header("Location: dbf/$bx.dbf");
Now I just need to write a code which takes data from each table, one by
one, and appends it to the DBF, alongwith adding a field that carries the
Identifier Value for each table.
Any suggestions?
Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180
Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com