我試圖用mysqli_multi_query()
做多個更新,但它不起作用。可以用mysqli_multi_query做UPDATE語句嗎?
$arr_updates[] = "UPDATE MYTABLE SET COLUMN = 'VALUE' WHERE ID = 1";
$arr_updates[] = "UPDATE MYTABLE SET COLUMN = 'VALUE' WHERE ID = 2";
$b = mysqli_multi_query($CONN,join("; ",$arr_updates));
$b
是FALSE,儘管SQL語句的語法是正確的。
是否mysqli_multi_query()
應該與MySQL UPDATE語句一起使用?或者有什麼方法可以優化我的更新聲明? (我不能使用switch語句。)
這些都是產生疑問:
UPDATE cj_term_taxonomy SET parent = 0 WHERE parent = 120;
UPDATE cj_term_taxonomy SET parent = 1 WHERE parent = 121;
UPDATE cj_term_taxonomy SET parent = 2 WHERE parent = 122;
UPDATE cj_term_taxonomy SET parent = 3 WHERE parent = 123;
UPDATE cj_term_taxonomy SET parent = 4 WHERE parent = 124;
UPDATE cj_term_taxonomy SET parent = 5 WHERE parent = 125;
UPDATE cj_term_taxonomy SET parent = 6 WHERE parent = 126;
UPDATE cj_term_taxonomy SET parent = 7 WHERE parent = 127;
UPDATE cj_term_taxonomy SET parent = 8 WHERE parent = 130;
UPDATE cj_term_taxonomy SET parent = 9 WHERE parent = 131;
UPDATE cj_term_taxonomy SET parent = 10 WHERE parent = 132;
UPDATE cj_term_taxonomy SET parent = 11 WHERE parent = 133;
UPDATE cj_term_taxonomy SET parent = 12 WHERE parent = 134;
UPDATE cj_term_taxonomy SET parent = 13 WHERE parent = 135;
UPDATE cj_term_taxonomy SET parent = 14 WHERE parent = 136;
UPDATE cj_term_taxonomy SET parent = 15 WHERE parent = 137;
UPDATE cj_term_taxonomy SET parent = 16 WHERE parent = 138;
UPDATE cj_term_taxonomy SET parent = 17 WHERE parent = 139;
UPDATE cj_term_taxonomy SET parent = 18 WHERE parent = 140;
UPDATE cj_term_taxonomy SET parent = 19 WHERE parent = 141;
UPDATE cj_term_taxonomy SET parent = 20 WHERE parent = 142;
UPDATE cj_term_taxonomy SET parent = 21 WHERE parent = 143;
UPDATE cj_term_taxonomy SET parent = 22 WHERE parent = 144;
UPDATE cj_term_taxonomy SET parent = 23 WHERE parent = 145;
UPDATE cj_term_taxonomy SET parent = 24 WHERE parent = 146;
UPDATE cj_term_taxonomy SET parent = 25 WHERE parent = 147;
UPDATE cj_term_taxonomy SET parent = 26 WHERE parent = 148;
UPDATE cj_term_taxonomy SET parent = 27 WHERE parent = 149;
UPDATE cj_term_taxonomy SET parent = 28 WHERE parent = 150;
UPDATE cj_term_taxonomy SET parent = 29 WHERE parent = 151;
UPDATE cj_term_taxonomy SET parent = 30 WHERE parent = 152;
UPDATE cj_term_taxonomy SET parent = 31 WHERE parent = 153;
UPDATE cj_term_taxonomy SET parent = 32 WHERE parent = 154;
UPDATE cj_term_taxonomy SET parent = 33 WHERE parent = 155;
UPDATE cj_term_taxonomy SET parent = 34 WHERE parent = 156;
UPDATE cj_term_taxonomy SET parent = 35 WHERE parent = 157;
UPDATE cj_term_taxonomy SET parent = 36 WHERE parent = 158;
UPDATE cj_term_taxonomy SET parent = 37 WHERE parent = 182;
UPDATE cj_term_taxonomy SET parent = 38 WHERE parent = 181;
UPDATE cj_term_taxonomy SET parent = 39 WHERE parent = 178;
UPDATE cj_term_taxonomy SET parent = 40 WHERE parent = 179;
UPDATE cj_term_taxonomy SET parent = 41 WHERE parent = 180;
UPDATE cj_term_taxonomy SET parent = 42 WHERE parent = 201;
你能顯示你真正的查詢嗎? –
陳述合成是正確的。我複製/過去在我的mysql工作臺生成的代碼,我看到沒有錯誤。 – Sebastien
也許mysql服務器配置? – Sebastien