我如何获取更新查询的rowID(我当然不是通过rowID更新)下面的代码是我正在使用的(作为类中的公共函数),但当然使用“lastInsertId()”不起作用对我来说(我真的没想到它会工作并且它返回 0)
$query = "UPDATE tSecurityDepositPaymentAddresses
SET
tGuardians_GuardianID = ?
WHERE tGuardians_GuardianID = 0
LIMIT 1";
$stmt = $db->prepare($query);
$stmt->execute(array($GuardianID));
return $db->lastInsertId();
我可以在嵌套选择中组合更新查询吗?还是有更简单的方法?
对不起,如果我的问题听起来很愚蠢,但我还在学习......
谢谢