dongzhi8487 2012-06-08 01:48
浏览 13

omegle clone的mysql_num_rows错误[关闭]

Upon downloading an omegle clone. This is of course poorly written, so there is an error in a crucial file. here's the site if you want to check it out. The error I get is Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a1687121/public_html/listenToReceive.php on line 11 here is the file:

<?php
$userId=$_REQUEST["userId"];

$msg   ="";
$randomUserId;

include ('config.inc.php');
include ('database.inc.php');
$result=mysql_query("SELECT * FROM chats WHERE userId = $userId ");

if (mysql_num_rows($result) > 0)
    {
    $result=mysql_query("SELECT * FROM msgs WHERE randomUserId = $userId ORDER BY sentdate limit 1");

    $id    =0;

    while ($row=mysql_fetch_array($result))
        {
        $id          = $row["id"];
        $msg         =$row["msg"];
        $randomUserId=$row["userId"];
        }

    if ($id != 0)
        {
        mysql_query ("DELETE FROM msgs WHERE id = $id ");
        mysql_query ("INSERT INTO oldMsgs(userId,randomUserId,msg) VALUES( $randomUserId,$userId,'$msg'); ");
        }
    }
else
    {
    echo "||--rut roh!--||";
    }

mysql_close ($con);

echo $msg;
?>

I checked it a million times. I cant find anything wrong. Thanks!

  • 写回答

1条回答 默认 最新

  • duanniu4106 2012-06-08 01:52
    关注
    $result=mysql_query("SELECT * FROM chats WHERE userId = $userId ");
    // add the error check
    if (!$result) {
        die('ERROR: ' . mysql_error());
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测