I get something like this.
This is working, but doing a MySQL query 40 times is not the best thing.
Can anyone help me by taking it in a query? You can generate a single query in that loop and then execute it only once:
$ query = '` table` ( 'INSERT' value in `unique_string`,` string_on`, `string_to`); $ QueryValues = array (); $ String_unique = 'Unique String'; $ Number = count ($ some); ($ (= $ Some_input)) for $ (= $ i = 0; $ i & lt; $ number; $ i ++) {$ string_one = 'something' $ I; $ String_two = 'some _ two' $ I; $ QuillValues [] = sprintf ('("% s", "% s", "% s"), $ unique_string, $ string_one, $ string_two);} Else {// I do not understand Coming to whom you are using this part ... anyway. $ QueryValues [] = sprintf ('("% s", "", "")', $ unique_string);}} $ Query. = Implode (',', $ queryValues); // and there is a unique key update // I do not know the whole structure, so I think you have the primary `id` line // What was unnecessary on your on-deployment key was. $ Query. = 'Key update of duplicates' ID` = `ID`'; // Do not use mysql_ * function in new code: // see: http: // stackoverflow .com / questions / 12859942 / why-shouldnt-i-use-mysql-functions-in-php mysql_query ($ query);
No comments:
Post a Comment