MySQL/PHP更新查询错误
我正在运行一个查询,以从PHP更新表中的一小组“项”。 使用“Sequel Pro”运行代码可以完美地执行它,同时使用mysql(“query here”)在PHP上运行它;失败得很惨 我的问题有什么不对吗MySQL/PHP更新查询错误,php,sql,mysql,mysql-error-1064,Php,Sql,Mysql,Mysql Error 1064,我正在运行一个查询,以从PHP更新表中的一小组“项”。 使用“Sequel Pro”运行代码可以完美地执行它,同时使用mysql(“query here”)在PHP上运行它;失败得很惨 我的问题有什么不对吗 UPDATE `service_joblocation` SET `in_use` = '1', `in_use_since` = '1283488686', `in_use_currentcount` = `in_use_currentc
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服务器版本
使用near'UPDATE的正确语法
service\u joblocation
SETin\u use
=
“1”,在使用中,因为
第2行
你能发布执行查询的PHP代码吗(我想你指的是mysql_query())。乍一看,这个查询看起来不错,但我认为它前面可能有不正确的地方,比如无意中的引号或大括号 只能将一条语句传递给mysql\u query()
还有其他功能/方法,例如,但不适用于旧的mysql扩展。service\u joblocation.in\u use和service\u joblocation.in\u use的数据类型是什么?如果它们是数字,请尝试删除引号,即
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;
是否存在重复的
service\u joblocation.id
值?如果不是,则在结尾处设置限制1
没有任何价值。。。为什么要包含与错误无关的其他UPDATE语句?我觉得您的查询没有问题。问题可能出在PHP代码中。你也可以发布吗?干杯:D我吓坏了,因为这个查询在应用程序中运行得很好。。我想它必须分别通过每个查询。