PDO更新语句不起作用

时间:2016-11-01 17:32:35

标签: php mysql pdo

$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] => 
)

0 个答案:

没有答案