我正在尝试获取它,以便从此查询中检索到的信息在通过我已指定为主键的 messageid 显示到页面上之前进行排序。我不断收到此错误:
Warning: krsort() expects parameter 1 to be array, resource given in ...
这是我的代码:
<?php
$id = $_SESSION[id];
$messages = @mysql_query("SELECT * FROM messages WHERE receiver='$id'");
$messagecount = mysql_num_rows($messages);
krsort($messages);
if ($messagecount == 0)
{
echo "<br>You have no messages.";
}
else
{
while ($messages2 = mysql_fetch_array($messages))
{
echo "<table width=800 class=\"normaltable\" cellpadding=\"3\" border=\"0\"><tr>
<td class=\"tdmessagesubject\"><b>Subject:</b><a href=message.php?id=" . $messages2['messageid'] . "> " . $messages2['subject'] . "</a></td>
<td class=\"tdmessagefrom\"><b>From:</b> " . $messages2['sendercallname'] . "</td> </tr>
</table>";
}
}
?>
我认为 $messages 是一个数组,但它似乎不起作用。