mySQL for loop stops working after 31 row updates [SOLVED] [Actually PHP related] -
I have a form that submits to the loop after using PHP. The loop updates individual rows in the database, which is presented after the next on the basis of the data of the form. However, I have found that if more than 31 lines need to be updated, then it stops working, it will make a complete update for the first 31 loops but will not work after the 31st loop?
Update: I have done some tests and it seems that the loop never ends, this result refreshes the page in the browser instead of printing it. Any idea what's going on?
Has it ever happened to someone else? Is there a MYSQL query setting anywhere that it is creating?
For ($ i = 1; $ i & lt; = $ total_results2; $ i ++) {Any help would be highly appreciated.} $ StrSQL = 'update timesheets_items SET'; $ StrSQL = 'Time_1 = "'. Convert_time ($ _ POST ['item_'. $ I. '_time_1']). '' '$ StrSQL. =', Time_2 =" '. Convert_time ($ _ POST ['item_'. $ I. '_time_2']) '' '; $ StrSQL = ', Time_3 = "' .convert_time ($ _ POST ['item_'. $ I. '_time_3']). '' '$ StrSQL.' ', Time_4 ="' Convert_time ($ _ POST ['item_'. $ I. '_time_4']). '' '; $ StrSQL = ', Time_5 = "' .convert_time ($ _ POST ['item_'. $ I. '_time_5']). '' '$ StrSQL.' ', Time_6 ="' Convert_time ($ _ POST ['item_'. $ I. '_time_6']). '' '; $ StrSQL = ', Time_7 = "'. Convert_time ($ _ POST ['item_'. $ I. '_time_7']). '' '$ StrSQL. =', Time_8 =" '. Convert_time ($ _ POST ['item_'. $ I. '_time_8']). '' '; $ StrSQL = ', Time_9 = "' .convert_time ($ _ POST ['item_'. $ I. '_time_9']). '' '$ StrSQL.' ', Time_10 ="' Convert_time ($ _ POST ['item_'. $ I. '_time_10']) '' '; $ StrSQL = ', Time_11 = "' .convert_time ($ _ POST ['item_'. $ I. '_time_11']). '' '$ StrSQL. =', Time_12 =" '. Convert_time ($ _ POST ['item_'. $ I. '_time_12']). '' '; $ StrSQL = ', Time_13 = "' .convert_time ($ _ POST ['item_'. $ I. '_time_13']). '' '$ StrSQL.' ', Time_14 ="' Convert_time ($ _ POST ['item_'. $ I. '_time_14']) '' '; $ StrSQL = ', Time_total = "' .convert_time ($ _ POST ['item_'. $ I. '_time_total']). '' '$ StrSQL. =', Ot_1 =" '. Convert_time ($ _ POST ['item_'. $ I. '_ot_1']). '' '; $ StrSQL = ', Ot_2 = "'. Convert_time ($ _ POST ['item_'. $ I. '_ot_2']). '' '$ StrSQL. =', Ot_3 =" '. Convert_time ($ _ POST ['item_'. $ I. '_ot_3']). '' '; $ StrSQL = ', Ot_4 = "'. Convert_time ($ _ POST ['item_'. $ I. '_ot_4']). '' '$ StrSQL.' ',' Ot_5 = '' Convert_time ($ _ POST ['item_'. $ I. '_ot_5']). '' '; $ StrSQL = ', Ot_6 = "'. Convert_time ($ _ POST ['item_'. $ I. '_ot_6']). '' '$ StrSQL. =', Ot_7 =" '. Convert_time ($ _ POST ['item_'. $ I. '_ot_7']). '' '; $ StrSQL = ', Ot_8 = "'. Convert_time ($ _ POST ['item_'. $ I. '_ot_8']). '' '$ StrSQL. =', Ot_9 =" '. Convert_time ($ _ POST ['item_'. $ I. '_ot_9']). '' ''; $ StrSQL = ', Ot_10 = "'. Convert_time ($ _ POST ['item_'. $ I. '_ot_10']). '' '$ StrSQL.' ', Ot_11 ="' Convert_time ($ _ POST ['item_'. $ I. '_ot_11']). '' '; $ StrSQL = ', Ot_12 = "'. Convert_time ($ _ POST ['item_'. $ I. '_ot_12']). '' '$ StrSQL. =', Ot_13 =" '. Convert_time ($ _ POST ['item_'. $ I. '_ot_13']). '' '; $ StrSQL = ', Ot_14 = "'. Convert_time ($ _ POST ['item_'. $ I. '_ot_14']). '' '$ StrSQL. =', Ot_total =" '. Convert_time ($ _ POST ['item_'. $ I. '_ot_total']). '' '; $ StrSQL = 'WHERE week_start = "'. $ Weeks_stat. '" And employee_id = "'. $ Id. '" And project_number = "'. $ _POST ['item_'. $ I. '_project_number']. '' And function = "'. $ _POST ['item_' $ I. _task '].' '' '; Mysql_query ($ strSQL); }
I have resolved this issue now! The problem was due to the input variable of my version of PHP (5.3) and permission on a form on PHP.
The problem is ending, not mysql at all. The bug found was that how many form variables have been taken by PHP, so MySQL should not allow the variables to be received at any time when time will come to run repeated queries.
To resolve this issue, set me up to update to PHP (5.4 or higher) and then set the "max_input_vars" setting to 3000. (The default setting only allows 1000.)
I hope that it helps any person who ever comes into this problem. / P>
Comments
Post a Comment