Re: how to display new icon for news posted within 2 days?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



paragasu wrote:
> is it possible to do it like
SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl
> 
$post = mysqli_fetch_object($sql);
if($post->is_new)
echo '<img src=new.gif">';

>From what I can tell, you'll just have a timestamp 2 days earlier than
the actual post date in the is_new var.  So unless the post date is
0000172800 or earlier it will eval to true.  How about:

SELECT *, UNIX_TIMESTAMP(post_date) as ts FROM tbl

if($post->ts > (time()-172800)) {
	echo '<img src="new.gif">';
}


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux