私のAjaxチャットスクリプトで、次の警告が表示されます。
Warning: mysql_fetch_array() expects parameter 1 to be resource,
boolean given in /home/mychat/public_html/c/listChats.php on line 7
7行目:
while($row = mysql_fetch_array($sql)){
listChats.php:
<?php
$chats = "";
include_once("scripts/connect_db.php");
$sql = mysql_query("SELECT * FROM (
SELECT * FROM chatBox order by id DESC LIMIT 20
) TMP ORDER BY tmp.id ASC");
while($row = mysql_fetch_array($sql)){
$chat = $row['chatBody'];
$username = $row['username'];
$chats = '<p><span id="un">' . $username . ':</span> ' . $chat . '</p>';
echo "$chats";
}
?>