Jump to content

[SOLVED] need help with a loop


MrBillybob

Recommended Posts

i have a .sql file with 58,000 lines i have a php script that loads it and runs it but it only runs 21,000 of those lines

 

i dont get the maximum loop time exceeded

 

<?php
mysql_connect("xxxxxxxxxxx", "xxxxx", "xxxxxx") or die("1");
mysql_select_db("xxxxxxx") or die("2");
$file = fopen("file.sql", "r") or die("3");
while ($line = fgets($file)){
$i++;
$sql .= $line;

$test = substr($line, -2, 1);
echo "\"" . $test . "\"";
//echo $line . "<br />";
if ($test == ";") {
	echo 1;
	@mysql_query($sql) or die(mysql_error());
	$sql = "";
}	
}
fclose($file);
mysql_close();
?>

Link to comment
https://forums.phpfreaks.com/topic/65340-solved-need-help-with-a-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.