Have a PHP script to update all rows in a table. Doesn't seem to me like too much data is being passed. I haven't had any problems with the script up until about 2 weeks ago when I started receiving "connection reset" errors on submission. I toyed with the script a little but I can't find a way to speed it up.
for ($i = 1; $i <= 360; $i++) {
$info = mysql_real_escape_string($_POST[$i]);
$check = mysql_real_escape_string($_POST[''.$i.'Check']);
mysql_query("UPDATE $table SET info = '$info', status = '$check' WHERE ID = '$i'")
or die (mysql_error());
}
I really can't tell what's causing the error. It's worked without a problem for so long. I know it's a lot updates but I'm sure larger scripts exist. Also the script walks perfectly some of the time. When it works, the script executes in about 2-3 seconds, which is why I'm not sure this script is actually causing the errors.
Thanks!
EDIT -- I played around and determined the problem is certainly the number of queries I have running. If I cut the loop to ($i - 1; $i <= 5; $i++) the script executes properly every time with no reset. I upped the the loop back towards 360 and the higher that number hte more queries and it seems the greater the chance of the script timing out. I still can't find a way to fix this, help, please!