我正在運行一個查詢來更新表中的一小組'項目',從PHP。使用「Sequel Pro」運行代碼可以完美地執行它,同時使用mysql在PHP上運行它(「query here」);悲慘地失敗了。MySQL/PHP更新查詢錯誤
查詢有什麼問題嗎?
UPDATE `service_joblocation`
SET `in_use` = '1',
`in_use_since` = '1283488686',
`in_use_currentcount` = `in_use_currentcount`+1,
`in_use_historicalcount`= `in_use_historicalcount`+1
WHERE `id` = 5
LIMIT 1;
UPDATE `service_joblocation`
SET `in_use` = '1',
`in_use_since` = '1283488686',
`in_use_currentcount` = `in_use_currentcount`+1,
`in_use_historicalcount` = `in_use_historicalcount`+1
WHERE `id`=16
LIMIT 1;
UPDATE `service_joblocation`
SET `in_use` = '1',
`in_use_since` = '1283488686',
`in_use_currentcount` = `in_use_currentcount`+1,
`in_use_historicalcount` = `in_use_historicalcount`+1
WHERE `id`=18
LIMIT 1;
UPDATE `service_items` SET `checkin_user`='9', `checkin_date`='1283488686', `location`='5' WHERE `id`=576;
UPDATE `service_items` SET `checkin_user`='9', `checkin_date`='1283488686', `location`='16' WHERE `id`=577;
UPDATE `service_items` SET `checkin_user`='9', `checkin_date`='1283488686', `location`='18' WHERE `id`=578;
UPDATE `service_jobs` SET `checkin_date`='1283488686', `checkin_user`='9',`checkin_department`='1',`checkin_client_person`='0', `items_x`=`items_x`+1 WHERE `id`='518' LIMIT 1;
UPDATE `service_jobs` SET `checkin_date`='1283488686', `checkin_user`='9',`checkin_department`='1',`checkin_client_person`='0', `items_x`=`items_x`+1 WHERE `id`='518' LIMIT 1;
UPDATE `service_jobs` SET `checkin_date`='1283488686', `checkin_user`='9',`checkin_department`='1',`checkin_client_person`='0', `items_x`=`items_x`+1 WHERE `id`='518' LIMIT 1;
這是輸出信息...
您的SQL語法錯誤; 檢查對應 你的MySQL服務器版本的 正確的語法使用近「UPDATE
service_joblocation
SETin_use
= '1',in_use_since
= '1283488686' 手動在 線2
是否存在重複的'service_joblocation.id'值?如果不是這樣,那麼在最後加上「LIMIT 1」沒有任何價值......爲什麼包含錯誤與之無關的其他UPDATE語句? – 2010-09-03 04:55:51
您的查詢對我來說確實很好。這個問題可能在於你的PHP代碼。你可以張貼嗎? – Mischa 2010-09-03 04:59:09