php - mysql_num_rows 的问题

标签 php mysql mysql-num-rows

出于某种原因,我无法理解我在 mysql_num_rows 方面遇到的麻烦。

脚本如下:

$notquery = 'SELECT * FROM notification WHERE uid = 1 AND read = 0 
AND tipo = post 
OR tipo = subpost OR tipo = logros';

$notQuery = (mysql_query($notquery));

$num_rows = mysql_num_rows($notQuery);

错误:

Warning:  mysql_num_rows(): supplied argument is not a valid MySQL result resource

最佳答案

这可能是因为您在查询执行过程中出现错误。
尝试添加 or die(mysql_error()) 来调试出现的问题...

将代码更新为:
$notQuery = mysql_query($notquery) 或 die(mysql_error());

关于php - mysql_num_rows 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4528711/

相关文章:

php - 如何在 MySQL 存储过程中计算这些日期差、乘法?

mysql - 返回特定字段中没有值的记录

php - MySQL如何知道某一行是否存在

mysql脚本转t-sql脚本

php - 有没有办法在 Propel 1 中结合 Archivable 和 Versionable 行为?

php - 有没有办法让我的网站自动扫描数据库并执行预定功能?

php - 如何在编辑表单上加载图像

php - 如何检查 mysql_query 是否返回任何内容

php - 警告 : mysql_num_rows(): supplied argument is not a valid MySQL result resource with no mysql_error()

Mysql 查询 - 如果一行中存在三个值?