wsg14
27-07-2008, 11:22 PM
<?php
if($logged['in'] === 0){
header("Location: index.php");
} else {
$query = mysql_query("SELECT * FROM `private_messages` WHERE `to` = '".$sess_username."' ORDER BY date DESC");
$pm_count = mysql_num_rows($query);
$today = date("m.d.Y");
$yesterday - mktime(0, 0, 0, date( 'm' ) , date( 'd' ) - 1, date( 'y' ));
$read = mysql_query("SELECT `read` FROM `private_messages` WHERE `to` = '".$sess_username."'");
while ($display = mysql_fetch_array($query)){
if($pm_count == 0){
echo 'You do not have any messages at this time.';
} else{
if($query->date == $today){
echo '<b>Today</b><br />';
if(!$read == 0){
echo "<b>" . $display['title'] . " - " . $display['from'] . "</b><br />";
} else {
echo $display['title'] . " - " . $display['from'] . "<br />";
}
}
if($query->date == $yesterday){
echo '<b>Yesterday</b><br />';
if(!$read == 0){
echo "<b>" . $display['title'] . " - " . $display['from'] . "</b><br />";
} else {
echo $display['title'] . " - " . $display['from'] . "<br />";
}
}
if(!$read == 0){
echo $display['date'] . "<br />";
echo "<b>" . $display['title'] . "-" . $display['from'] . "</b><br />";
} else {
echo $display['date'] . "<br />";
echo $display['title'] . "-" . $display['from'] . "</b><br />";
}
}
}
}
?>With that, code basically I want the PM's to show like this:
Today
yo - user1
Yesterday
brb - user2
01.01.01
nah - user3
etc.But with that code it's showing this:
Yesterday
lolol - a guy
07-27-2008
lolol-a guyFirst problem is that it's showing 1 message twice, in two different time frames (07-27-2008 - that's what is in the DB for 'date').
I cannot seem to find out why it's doing that. Many thanks to whoever fixes it.
Moved by Invent (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks :).
if($logged['in'] === 0){
header("Location: index.php");
} else {
$query = mysql_query("SELECT * FROM `private_messages` WHERE `to` = '".$sess_username."' ORDER BY date DESC");
$pm_count = mysql_num_rows($query);
$today = date("m.d.Y");
$yesterday - mktime(0, 0, 0, date( 'm' ) , date( 'd' ) - 1, date( 'y' ));
$read = mysql_query("SELECT `read` FROM `private_messages` WHERE `to` = '".$sess_username."'");
while ($display = mysql_fetch_array($query)){
if($pm_count == 0){
echo 'You do not have any messages at this time.';
} else{
if($query->date == $today){
echo '<b>Today</b><br />';
if(!$read == 0){
echo "<b>" . $display['title'] . " - " . $display['from'] . "</b><br />";
} else {
echo $display['title'] . " - " . $display['from'] . "<br />";
}
}
if($query->date == $yesterday){
echo '<b>Yesterday</b><br />';
if(!$read == 0){
echo "<b>" . $display['title'] . " - " . $display['from'] . "</b><br />";
} else {
echo $display['title'] . " - " . $display['from'] . "<br />";
}
}
if(!$read == 0){
echo $display['date'] . "<br />";
echo "<b>" . $display['title'] . "-" . $display['from'] . "</b><br />";
} else {
echo $display['date'] . "<br />";
echo $display['title'] . "-" . $display['from'] . "</b><br />";
}
}
}
}
?>With that, code basically I want the PM's to show like this:
Today
yo - user1
Yesterday
brb - user2
01.01.01
nah - user3
etc.But with that code it's showing this:
Yesterday
lolol - a guy
07-27-2008
lolol-a guyFirst problem is that it's showing 1 message twice, in two different time frames (07-27-2008 - that's what is in the DB for 'date').
I cannot seem to find out why it's doing that. Many thanks to whoever fixes it.
Moved by Invent (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks :).