douyinglan2599 2012-07-21 18:12
浏览 57
已采纳

在PHP中使用mySQL_num_rows很困难[关闭]

$i_id = $_GET['iiSL'];   

require_once('../include/dbc.php');    

$sql = "SELECT invite_id FROM invite_requests WHERE invite_id = '$i_id'";
$result = mysql_query($sql);
if(mysql_num_rows($result == 1))
{
echo 'GOOD ID EXISTS';
//ECHO IS JUST TO TEST  
} 
else
{
echo 'BAD ID IS NOT IN DB';
//ECHO IS JUST TO TEST
}

Why is this not working? It's driving me insane.

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

All spelling, grammar, syntax, and case is correct. URL is passing the $i_id variable. It echo's out correctly.

What am I doing wrong?

  • 写回答

2条回答 默认 最新

  • doukuizuo1795 2012-07-21 18:13
    关注

    There is a typo in the condition..try this..

    if(mysql_num_rows($result) == 1)
    

    You are passing result of $result == 1 to mysql_num_rows which expects a result resouce of mysql_query()..:)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制