$sql = " UPDATE users
SET name = ?, role = ?, status = ?
WHERE name = ?";
$stmt = execute_query($sql);
$stmt->execute(array($name, $role, $status, $name));
if($stmt->rowCount()) {
echo "yes";
} else {
echo "no";
print_r($conn->errorInfo());
function execute_query($sql)
{
global $conn;
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
return $conn->prepare($sql);
}
这将抛出以下内容,这意味着没有行受到影响。我在查询中犯了什么错误?
(
[0] => 00000
[1] =>
[2] =>
)