MrBillybob Posted August 17, 2007 Share Posted August 17, 2007 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(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/65340-solved-need-help-with-a-loop/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.