-3

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

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

4

1 回答 1

1
$result=mysql_query("SELECT * FROM chats WHERE userId = $userId ");
// add the error check
if (!$result) {
    die('ERROR: ' . mysql_error());
}
于 2012-06-08T01:52:39.223 回答