mysql stmt num rows_mysqli准备语句num_rows函数

所以这是我在MYSQLi中工作的第一天(从mysql转换过来),并且我在登录脚本中遇到麻烦,我在其中检查重复的电子邮件:

这是我所拥有的:

$email = mysqli_escape_string($_POST['email']);

$stmt=$mysqli->prepare("SELECT username from users WHERE email=?");

$stmt->bind_param('s',$email);

$stmt->execute();

$nrows1=$mysqli->num_rows;

echo $nrows1;

$stmt->close();

if ($nrows1>0) {

$_SESSION['loggedin'] = false;

$_SESSION['error'] = "Our records indicate that there is already an account registered with that email. Please use the 'forgot your password' link below if you cannot remember your password.";

header('Location: registration.php');

echo "running insisde duplicate email";

exit();

}

当回显$nrows1时,我一直返回0行或一个空变量.当我直接在sql中输入查询时,它工作正常.我似乎正在关注这些文件,并对其进行了一些修改.

我还使用了受影响的行功能,但我认为这不适合SELECT语句,对吗?

真诚的感谢您的帮助,我们将不胜感激.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值