mysql_num_rows错误 [英] mysql_num_rows error

查看:57
本文介绍了mysql_num_rows错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对mysql_num_rows()函数有问题.我检查了查询(它具有正确的语法,并且在sql中得到了结果)并已连接到数据库,并且一切似乎都能正常工作.

I have problem with mysql_num_rows() function. I've checked query (it has proper syntax and I'm getting the result in sql) and connection to database and everything seems to be able to work.

// some code here, connecting to database and working query to db
$query = "SELECT ff_client.email FROM ff_order, ff_client WHERE ff_order.id = '$order_number' AND ff_order.client_id = ff_client.id AND ff_client.email = '$email'";
if (!$result = mysqli_query($db, $query))   {
    echo '<p>Query wasn\'t found.</p>';
    exit;
}
if (!$num = mysql_num_rows($result)) {   // < the problem
    echo 'error';
}
if ($num == 0) {
    echo '<p>Insert proper email address.</p>';
}
else
{
    $_SESSION['crazyfotoApp']['token'] = $order_number;
    $_SESSION['crazyfotoApp']['multiformat'] = 1;
    header('Location: http://www.my.page.pl/zamow-odbitki.php?u=1');
}

我得到了这个结果:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/sda3/www/www1.my.page.pl/recover.php on line 37
error
Insert proper email address.

推荐答案

尝试使用mysqli_num_rows代替mysql_num_rows

try mysqli_num_rows instead of mysql_num_rows

这篇关于mysql_num_rows错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆