[英]MySQL Update Statement Returning No Affected Rows
I'm struggling to find an error in this. 我正在努力寻找一个错误。 I am running an Update command in MySQL through PHP. 我正在通过PHP在MySQL中运行更新命令。
UPDATE `diary` SET `meds_taken` = 'Y' AND `time_taken` = '9AM' AND
`stress_level` = '7' AND `adverse` = 'N' AND `events` = 'testing' AND
`journal_date` = '2015-07-14' AND `submit_time` = NOW() WHERE `hash` =
'a9fc195dc62624db5fddd7134392ce67'
It does not return any errors, but affects 0
rows. 它不会返回任何错误,但会影响0
行。 Running the command directly in PHPMyAdmin has the identical effect. 直接在PHPMyAdmin中运行命令具有相同的效果。
To confirm, there is a row with the hash: 确认一下,有一行带有哈希:
SELECT * FROM `diary` WHERE `hash` = 'a9fc195dc62624db5fddd7134392ce67'
Yields one row. 产生一排。 All the updated columns are of type VARCHAR
except for "events" which is of type TEXT
and "submit_time" which is of type DATE
. 所有更新的列的类型均为VARCHAR
但“事件”的类型为TEXT
和“ submit_time”的类型为DATE
。
I feel like I made a typo somewhere but cannot find it 我觉得我在某处打错了,但找不到
Try commas, rather than ANDs: 尝试使用逗号,而不是AND:
UPDATE `diary`
SET `meds_taken` = 'Y',
`time_taken` = '9AM',
`stress_level` = '7',
`adverse` = 'N',
`events` = 'testing',
`journal_date` = '2015-07-14',
`submit_time` = NOW()
WHERE `hash` = 'a9fc195dc62624db5fddd7134392ce67';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.