Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 返回PDO更新查询的rowID_Php_Mysql_Pdo_Sql Update - Fatal编程技术网

Php 返回PDO更新查询的rowID

Php 返回PDO更新查询的rowID,php,mysql,pdo,sql-update,Php,Mysql,Pdo,Sql Update,如何获取更新查询的rowID(我当然不是通过rowID进行更新) 下面的代码是我正在使用的(作为类中的公共函数),但是使用“lastInsertId()”当然对我不起作用(我真的不希望它起作用,它返回0) 我可以在嵌套的select中组合更新查询吗?还是有更简单的方法 对不起,如果我的问题听起来很糟糕,但我仍在学习 谢谢没有行id,因为更新可以应用于几个rowsOk,谢谢hek2mgl!!此外,MySQL没有行ID。 $query = "UPDATE tSecurityDepositPaymen

如何获取更新查询的rowID(我当然不是通过rowID进行更新) 下面的代码是我正在使用的(作为类中的公共函数),但是使用“lastInsertId()”当然对我不起作用(我真的不希望它起作用,它返回0)

我可以在嵌套的select中组合更新查询吗?还是有更简单的方法

对不起,如果我的问题听起来很糟糕,但我仍在学习


谢谢

没有行id,因为更新可以应用于几个rowsOk,谢谢hek2mgl!!此外,MySQL没有行ID。
$query = "UPDATE tSecurityDepositPaymentAddresses
                SET
                    tGuardians_GuardianID = ?
                WHERE tGuardians_GuardianID = 0
                LIMIT 1";                   
        $stmt = $db->prepare($query);
        $stmt->execute(array($GuardianID));             
        return $db->lastInsertId();