尝试使用此功能从我的数据库中获取未读消息,但我以这样的资源 id 错误结束:“ Resource id #45
”
function unread_message_count() {
$sql = "SELECT conversations_messages.message_id, conversations_members.user_id, conversations_members.conversation_last_view, conversations_messages.message_date
FROM conversations_members
INNER JOIN conversations_messages ON conversations_messages.user_id = conversations_members.user_id
WHERE conversations_members.conversation_last_view < conversations_messages.message_date AND conversations_members.user_id = {$_SESSION['user_id']}";
$result = mysql_query($sql);
return $result;
}
我以这种方式调用该函数,但没有打印:
$count = unread_message_count();
echo $count;