PHP的-单引号或双引号围绕SQL查询?

PHP的-单引号或双引号围绕SQL查询?,第1张

PHP的-单引号或双引号围绕SQL查询?

使用PDO代替这些方法中的任何一种。它将允许您使用参数而不是字符串

$sth = $dbh->prepare('SELECt * FROM users WHERe username = :username AND password = :password LIMIT 1');$sth->bindParam(':username', $username, PDO::PARAM_STR);$sth->bindParam(':password', $password, PDO::PARAM_STR);$sth->execute();

顺便说一句,请确保不要同时使用纯文本密码。



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5662350.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存