I have the following code:
function fetch_conversation_messages($conversation_id){
    $conversation_id = (int)$conversation_id;
    $sql = "SELECT
                            `conversations_messages`.`message_date`,
                            `conversations_messages`.`message_date` > `conversations_members`.`conversation_last_view` AS `message_unread`,
                            `conversations_messages`.`message_text`,
                            `users`.`user_name`
                    FROM `conversations_messages`
                    INNER JOIN `users` ON `conversations_messages`.`user_id` = `users`.`user_id`
                    INNER JOIN `conversations_members` ON `conversations_messages`.`conversation_id` = `conversations_members`.`conversation_id`
                    WHERE `conversations_messages`.`conversation_id` = {$conversation_id}
                    AND `conversations_members`.`user_id` = {$_SESSION['user_id']}
                    ORDER BY `conversations_messages`.`message_date` DESC";
    $result = mysql_query($sql);
    var_dump($result);
    $messages = array();
    while (($row = mysql_fetch_assoc($result)) !== false){
            $messages[] = array(
                    'date'          => $row['message_date'],
                    'unread'        => $row['message_unread'],
                    'text'          => $row['message_text'],
                    'user_name'     => $row['user_name'],
            );
    }
    var_dump( $messages );
}
It should return something like this:
Array ( [0] => Array ( [date] => 1322254667 [text] => one [user_name] => bob ) )
However, it returns
resource(16) of type (mysql result) array(0) { }
I am completely new to PHP and MySQL, but I have tried checking for typos, echoing mysql_error, and killing the script at an error, which shows that there is no error in the SQL.
I do not know what has gone wrong and how to fix it.
Please help me. Thanks in advance.
 
     
     
     
     
    