HI
I Need to display an image when Category Update and that image display upto 3 days
i use this but not work
$todaytime = time();
$timestamp = $show_wallpaper['timestamp'];
$timediffirence = "360000";
$minus = $todaytime - $timestamp;
if ($timediffirence > $minus) {
$new = "<img src='$siteurl/images/new.gif' />";
} else {
$new = "";
}
database info
$sql = "SELECT SQL_NO_CACHE * FROM wallpaper WHERE categoryid = $catid order by wallpaperid desc LIMIT $from,$max_results";
so help me to fix it I do like this
IF Category Update then display this image for 3 days else remove image开发者_高级运维 this is my task reply
Firstly, $timediffirence
is a number, it does not therefore need to be in double quotes, try this first:
$timediffirence = 360000;
Secondly, 360000 is not 3 days in seconds, it should be
((60 * 60) * 24) * 3 = 259200
Finally, try debugging by printing out the values of $minus
and comparing it with $timediffirence
精彩评论