Hi Oliver,
I use the folowing in a script:
Note: $ADMIN is the connection class to the MySQL database. I Build my own
CMS_class witch uses Pear to connect to a database. But I guess you
can read between the lines and use all the usefull stuff
Regards,
Eric
Freelance PHP Programmer.
function makedumpfile($table,$exkey="") {
global $ADMIN;
$query="select * from ".$table;
$result=$ADMIN->query($query);
if (is_file("../temp/".$table.".sql")) unlink ("../temp/".$table.".sql");
$fp=fopen("../temp/".$table.".sql","w");
fwrite($fp,"DELETE FROM ".$table."\r\n");
while ($Record=$result->fetchRow(DB_FETCHMODE_ASSOC)) {
//print_r($Record);
$velden="";
$waarden="";
foreach ($Record as $key=>$waarde) {
if ($exkey!=$key) {
$velden.=$key.",";
$waarden.="'".$waarde."',";
}
}
//for($j=0; $j<$localdb->numCols($result);$j++)
//$table_list .= mysql_field_name($result,$j).", ";
$velden=substr($velden,0,-1);
$waarden=substr($waarden,0,-1);
$dumptekst="INSERT INTO ".$table." (".$velden.") VALUES
(".str_replace("\r\n","",$waarden).")";
$dumptekst.="\r\n";
fwrite($fp,$dumptekst);
}
fclose($fp);
}
"Oliver Spiesshofer" <ol****@email.com> schreef in bericht
news:Xn****************************@63.223.5.254.. .
Hi,
is there some free script that exports a whole database to a file similar
to mysqldump but without using mysqldump?
It should not be embedded too deeply into an application since I want to
include it into another open-source project without having to disassemble
a major other script such as phpMyAdmin.
thanks
Oliver
"Oliver Spiesshofer" <ol****@email.com> schreef in bericht
news:Xn****************************@63.223.5.254.. . Hi,
is there some free script that exports a whole database to a file similar
to mysqldump but without using mysqldump?
It should not be embedded too deeply into an application since I want to
include it into another open-source project without having to disassemble
a major other script such as phpMyAdmin.
thanks
Oliver