I'm trying to make a social network and are adding a notification bar on the site, but the code is not loading the data from the database.
$newpm_sql = mysql_query("SELECT * FROM `pm` 
                          WHERE `to` = '". $_SESSION['id'] ."' 
                          ORDER BY `id` DESC") or die(mysql_error());
if (mysql_num_rows($newpm_sql) == 0) { 
    $newpm = '<div id="notificationTitle">Meddelande</div>
    <div id="notificationsBody" class="notifications">
       Du har inga meddelanden! 
    </div>
'; 
} else {
    while ( $newpm = mysql_fetch_array( $newpm_sql )) {
        $from_sql = mysql_query("SELECT * FROM `members` 
                                 WHERE `id` = '". $newpm['from'] ."'") 
               or die(mysql_error());
        $from = mysql_fetch_array($from_sql);
        if ($newpm['status'] == 0) { 
            $newpm = '<div id="notificationTitle">Meddelande</div>
                      <div id="notificationsBody" notifications">'. 
                         $newpm['subject'] .' '. $newpm['from'] .
                       '</div>'; 
        }
    }
}
 
     
    