I dont understand why your using $query->send_date?

I dont understand why your using $query->send_date?
Hi, names James. I am a web developer.
It's basically saying the the send_date table from private_messages = today's date.
Is there another way to accomplish the same thing?
Thanks Tom, but when I use your code you gave me for the echo $display... I had <b>code</b> in it. If I keep it I get an error "unexpected "<"".
Last edited by wsg14; 26-07-2008 at 07:05 PM.
try this
PHP Code:<?php
$query = mysql_query("SELECT * FROM `private_messages` WHERE `to` = '".$sess_username."' ORDER BY date DESC");
$display = mysql_fetch_array($query);
$pm_count = mysql_num_rows($query);
$today = date("m.d.Y");
$yesterday - mktime(0, 0, 0, date( 'm' ) , date( 'd' ) - 1, date( 'y' ));
if($pm_count == 0){
echo 'You do not have any messages at this time.';
} else{
if($query->send_date == $today){
echo '<b>Today</b><br />';
if(!$read == 0){
echo "<b>".$display['name']."</b> - ".$display['from']."<br />";
} else {
echo "".$display['name']." - ".$display['from']."<br />";
}
}
if($query->send_date == $yesterday){
echo '<b>Yesterday</b>';
if(!$read == 0){
echo "<b>".$display['name']."</b> - ".$display['from']."<br />";
} else {
echo "".$display['name']." - ".$display['from']."<br />";
}
}
}
?>
Dont think Dom's is right but I commented where I got stuck re-coding it.
PHP Code:<?php
$today = date( 'm.d.Y' );
$yesterday = date( 'm.d.Y', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'y' ) ) );
$mysqlQuery = mysql_query( 'SELECT * FROM `private_messages` WHERE `to` = "' . $sess_username . '" ORDER BY `date` DESC' );
if( mysql_num_rows( $mysqlQuery ) == 0 )
{
echo( 'Sorry, you have no messages at the this present time' );
}
else
{
while( $r = mysql_fetch_array( $mysqlQuery ) )
{
if( $r[ 'send_date' ] == $today )
{
echo( 'Today' );
}
elseif( $r[ 'send_date' ] == $yesterday )
{
echo( 'Yesterday' );
// don't know where you define $read lol
}
}
}
?>
Hi, names James. I am a web developer.
Thanks for the help Dom and Protege, but Tom beat you all to the punch.
Not to be pedantic but echo is not a function and therefore doesn't require parenthesis. It looks like a problem with how your outputting the data, download Aptana Studio for free, and debug in that (it will underline bad code).
How could this hapen to meeeeeeeeeeeeeee?lol.
You're gay.
Edited by Invent (Forum Moderator): Please don't be rude.
Last edited by Invent; 26-07-2008 at 09:49 PM.
Maybe so, but it does make debugging easier and doesn't slow down your script execution time badly.Not to be pedantic but echo is not a function and therefore doesn't require parenthesis.
It is a language construct, but it works either ways. You can use it like you are calling it as a method/function.
is the same asPHP Code:echo "hey";
as well as the same asPHP Code:echo("hey");
as well asPHP Code:echo 'hey';
So it really doesn't matter, but server setups vary.PHP Code:echo ('hey');
Aptana Studio free version isn't really good. I suggest you *look* for a professional copy of Aptana Studio with the PHP plugin, or a copy of Zend Studio for Eclipse (free 30 day trial)
I would recommend Zend Studio over Aptana![]()
I'll go hunting for Zend Studio later on. Is it better than phpDesigner 08?
Want to hide these adverts? Register an account for free!