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">';

On 1/14/09, Phpster <phps...@gmail.com> wrote:
> Make it easy and store the date as a unix timestamp. Then it's a
> simple test    to do
>
> If ((current timestamp - db timestamp) < 172,800 ){
>   echo '<img src='new.gif'>';
> }
>
> Conversely, you can use strtotime() to convert the date.
>
> Bastien
>
> Sent from my iPod
>
> On Jan 14, 2009, at 10:36 PM, paragasu <parag...@gmail.com> wrote:
>
>> i do have a mysql table with one date field.
>> what i want is to display and tiny icon (red new icon) so user will
>> notice it is a new post.
>> i am looking for the simplest solutions here.
>>
>> i believe we can calculate whether the date is within two days of user
>> current time.
>> then we display an icon based on it.
>>
>> can anyone help?
>>
>> thanks
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>

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

Reply via email to