How do i do so it show all messages insted of only one, and other problem is that when the user have read there message and this part of the code right below are not showing. The full code can you find at the bottom of the page.
THIS CODE PART ARE NOT SHOWING AFTER A USER HAVE READ THERE NEW MESSAGE, BUT I WILL NOT SHOW:
$newpm = '<div id="notificationTitle">Message</div>
<div id="notificationsBody" class="notifications">You have no new messages</div>';
THE FULL CODE:
$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">Message</div>
<div id="notificationsBody" class="notifications">You have no new messages</div>';
} else {
while ( $row = mysql_fetch_array( $newpm_sql )) {
$from_sql = mysql_query("SELECT * FROM `members`
WHERE `id` = '". $newpm_sql['from'] ."'")
or die(mysql_error());
$from = mysql_fetch_array($from_sql);
if ($row['status'] == 0) {
$newpm = '<div id="notificationTitle">Message</div>
<div id="notificationsBody" notifications">
<b><a href="page.php?name=profile&id='. $row['from'] .'">'. $row['subject'] .'</a></b><br> '. $row['text'] .'
'</div>';
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…