Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在从 MYSQL 迁移到 PDO。我阅读了 PDO 官方文档,但在代码上找不到失败。
$name = 'fooUser'; $stmt = $PDO->prepare('SELECT * FROM users WHERE username=:name'); $stmt->bindParam(':name', $name, PDO::PARAM_INT ); $stmt->execute();
此查询返回我受影响的行,它不应该发生。
改变
$stmt->bindParam(':name', $name, PDO::PARAM_INT );
至
$stmt->bindParam(':name', $name, PDO::PARAM_STR );
您设置了错误的输入类型!