我運行下面的查詢的價值,通過PHP的mysqli $con->query($sql);
UPDATE DB SET ...填充一個具體的VARCHAR 0或1,無論我設置
PHP代碼:
$sql = 'UPDATE registrations SET '.$update_columns_list.' WHERE registrationkey = "'.$registration['RegistrationKey'].'"';
echo "RESULT: ".$result = $con->query($sql);
價值在上面的例子中$sql
:
UPDATE registrations SET referenceid = "4469731" and action = "newregistration" and status = "newregistration" and registrationdatetimegmt = "1363371386" and billingmonth = "2013-03" and accessexpirationdatetimegmt = "1373957999" and returnurl = "https://api.mywebsite.com/login.aspx?siteid=209" and lastmodifieddatetimegmt = "1363371398" and studentkey = "12345-67890-12345-67890" and firstname = "amanda" and lastname = "hemingway" and email = "[email protected]" and phonenumber = "111-111-1111" and city = "city" and state = "ca" and postalcode = "90210" and country = "us" and coursecode = "ABC-406" and coursetitle = "example course title" and courseproductcode = "t3310" WHERE registrationkey = "12345-67890-12345-67890"
一切似乎都很好,當我運行此查詢(我得到一個「成功」的消息和受影響的行數與預期)。但是,當我通過phpMyAdmin查看數據庫中受影響的行時,我在「referenceid」列中不斷找到1或0值。沒有其他腳本影響此表或數據庫。我一直無法確定何時放置0而不是1的任何模式。
referenceid
和keyid
這兩個字段都是VARCHAR(100)
's。
是完整的更新語句正在執行? – 2013-03-25 14:54:51
查詢中的php代碼是什麼? – Waygood 2013-03-25 14:56:38
用逗號代替'和' – Alex 2013-03-25 14:59:08