Shawn McKenzie wrote: > 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">'; > } > > In MySQL 5+ something like this may work with your code: SELECT *, IF(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(post_date) < 172800, 1, 0) AS is_new FROM tbl -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php