我想将下面的MySQL查询更改为MySQLi(预处理语句),但我不知道如何操作,因为它有多行要选择.任何人都可以指出正确的方式.
$check_added_files = MysqL_query("select * from `vpb_uploads` where `username` = '".MysqL_real_escape_string($username)."' and `firstname` = '' and `image_one` != '' and `image_two` != '' and `image_three` != '' and `image_four` != '' and `image_five` != ''");
if(MysqL_num_rows($check_added_files) == 1)
{
echo 'up_to_five_already';
}
解决方法:
$sql = "select * from vpb_uploads where username=? and firstname=''
and image_one != '' and image_two != '' and image_three != ''
and image_four != '' and image_five != ''";
$stm = $pdo->prepare($sql);
$stm->execute(array($username));
$files = $stm->fetchAll();
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。