mercredi 6 mai 2015

Error with displaying system messages in inbox

I have one file for messages between users, also in this file are system messages from the web site. The inbox, write message etc are okey, but the system messages are the problem.

The problem is that they are in the database but didn't show on the display. I see only error

You don't have system messages.

I make them from_user id to be 0, so they can be separated from other messages. Here is the code of system messages:

    if($page=="sys"){
    $mysql->query("SELECT M.*, UF.username AS user_from, UF.has_pic FROM message M
        INNER JOIN user UF ON UF.id=M.from_userFK 
        WHERE to_userFK='".$userProfile['id']."' AND from_userFK=0 AND M.del='no' ORDER BY send_time DESC");
    while($res = $mysql->fetch_array()){
        $sys_messages[]=$res;
    }
    if(count($sys_messages)>0){
        foreach($sys_messages AS $message){
            echo showMailInBox($message,$page);
        }
    }else{
        echo '<div class="bluealert" style="width: 380px;"><strong>You don't have system messages!</strong></div>';
    }
}

Aucun commentaire:

Enregistrer un commentaire