2 things. In that query, you can't have a comma in your 172,800. It's
going to fail b/c 800 isn't a column name. Unless it actually is, then
you're good to go. =D Secondly, to be more user friendly, if the user
has viewed that news item, then mark it as read (take away the
new.gif). There are a couple of ways to achieve this. One, you can use
cookies to keep track of what they've read. The other is to keep track
in the database (sorta like user preferences). Good luck.
~Philip
PS... Sorry to top post. It was the trend of the email and I didn't
want to break it.
On Jan 15, 2009, at 7:50 AM, Phpster wrote:
That should work as well
Bastien
Sent from my iPod
On Jan 15, 2009, at 4:14 AM, paragasu <paragasu@xxxxxxxxx> 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">';
On 1/14/09, Phpster <phpster@xxxxxxxxx> 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 <paragasu@xxxxxxxxx> 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