mysql_num_rows Omegle 克隆的错误



下载一个 omegle 克隆时。这当然写得不好,所以关键文件中有一个错误。如果您想查看,这里是网站。我得到的错误是Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a1687121/public_html/listenToReceive.php on line 11这里是文件:

<?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;
?>

我检查了一百万次。我找不到任何错误。谢谢!

$result=mysql_query("SELECT * FROM chats WHERE userId = $userId ");
// add the error check
if (!$result) {
    die('ERROR: ' . mysql_error());
}

相关内容

  • 没有找到相关文章

最新更新