Inserting an SQL file into MySQL Database...
Posted: Sun Nov 19, 2006 10:12 pm
I've got this script that inserts the contents of an SQL file into a MySQL Database. However, it is messing up my HTML Editites because it replaces ; with nothing... Does anyone have a script that works better or can fix this script?
Code: Select all
$dump = @file("update.sql");
$count = count($dump);
for ($i=0 ;$i<$count ;$i++) {
if (!trim($dump[$i])) continue;
if (ereg("^#",$dump[$i])) continue;
$content .= str_replace(";","",$dump[$i]);
if (ereg(";$",trim($dump[$i]))) {
mysql_query($content);
$content = "";
}
}