1
我已經寫了我的web應用程序(Magento的)重置客戶的密碼PHP腳本:當我嘗試從shell執行shell腳本示數出因認爲MySQL的語法錯誤
$write->query("update customer_entity_varchar set value='$password'
where entity_id=$customer_id and attribute_id in (select attribute_id from eav_attribute
where attribute_code='password_hash' and entity_type=1)");
然而, :
php script.php
它產生以下錯誤:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]:
Syntax error or access violation: 1064 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 'and attribute_id in (select attribute_id from eav_attribute where attribute_code' at line 1' in /chroot/home/html/lib/Zend/Db/Statement/Pdo.php:228
注:變量是先前d在腳本開始時就有所定義,但我沒有在這裏列出,因爲我覺得它們是無關的。
你會得到什麼,如果你打印整個查詢? –
偉大的問題,讓我登錄並看看。 – sparecycle
也許問題是唯一一個沒有引號? entity_id = $ customer_id和 – Matt