Beth2 Posted July 2, 2007 Share Posted July 2, 2007 Hi, I have a script that inserts about 500 rows into a mysql database, but most of the rows don't get entered. When I try with a small amount of data then the program works fine, but when I run it on all 500, then it goes wrong. The INSERT statement is in $q and last three lines in my function are: $res=mysql_query($q); echo "res=".$res; return; The value it prints for $res is "still in process", but the query $q never actually completes. Anyone know what I should do? Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 2, 2007 Share Posted July 2, 2007 Add a delay after each query, perhaps - http://ca.php.net/manual/en/function.usleep.php Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 2, 2007 Share Posted July 2, 2007 How do you assemble your query? Is it alot of separate "INSERT INTO table VALUES(x,y,z)" queries, or all 500 values in one query, "INSERT INTO table VALUES(x,y,z), (a,b,c,), (d,e,f,),...etc"? Quote Link to comment Share on other sites More sharing options...
Beth2 Posted July 2, 2007 Author Share Posted July 2, 2007 Each query inserts a single row. I'll try adding the delay though now - cheers Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 2, 2007 Share Posted July 2, 2007 Try putting them all in one query. It should work, and without delay. Quote Link to comment 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.