从php运行代码时没有获得最后更新的ID。如果查询在phpmyadmin中运行,它将返回最后更新的id

时间:2016-11-18 06:35:32

标签: php mysql

从PHP运行代码时没有获得上次更新的ID。如果查询在PHPMyAdmin中运行,它将返回上次更新的id

SET @LastUpdateID := 0;
UPDATE ibe_session_pool t1 JOIN
(
SELECT t2.id FROM ibe_session_pool t2
WHERE t2.query_in_progress='0' LIMIT 0,1
)dummy
ON t1.id=dummy.id
SET t1.sequence_number = (CASE  
WHEN t1.sequence_number < 999 THEN t1.sequence_number+1
ELSE 1
END),
t1.id = (SELECT @LastUpdateID := t1.id),
t1.query_in_progress='1';
SELECT @LastUpdateID AS LastUpdateID;
$afftectedRows =  $this->db->query($queryUpdate);

0 个答案:

没有答案