Notification Alert for messages in PHP
hi i have PHP simple sc开发者_如何学运维ript in which i add only news, i need a formula in which it will do the following 1. for any news messages or news added within 12 hours from the previous one it will show it as news and it will ad new near that message
- the information in this script will be added in to database (Mysql)
You need to store timestamp (you can access timestamp via time() function) and store it in your news database. When news listing you will check this timestamp with operators.
like
if ($timestamp > time() - 86400) echo 'new';
You should store the news' timestamp. When you display your news you should check the difference between current time and saved timestamp. If this difference is less than a day you should display new.gif.
精彩评论