次のように updateAll を実行しようとしています。
// initialize the array
$array = array(
"Land Rover" => array("LAND ROVER")
);
// loop both arrays
foreach($array as $new => $aOld) {
foreach($aOld as $old) {
$this->updateAll(array('make = $new'), array('make = $old'));
}
}
しかし、私はエラーが発生します:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Rover WHERE `make` = 'LAND ROVER'' at line 1
私が求めているのは:
UPDATE items SET make = 'Land Rover' WHERE make = 'LAND ROVER';
それ以上の他の配列要素があるため、大文字と小文字の変換については回答しないでください。
エラーを回避するにはどうすればよいですか? 実際、完全なSQLをダンプするにはどうすればよいですか? でこのコードを実行していConsole
ます。
どうもありがとう。
編集:SQLのデバッグを取得しました:
UPDATE `items` AS `Item` SET `Item`.`id` = make = "Land Rover" WHERE `make` = '\"LAND ROVER\"'
明らかな問題ですが、どうやってそこにたどり着いたのですか?