有人能帮我吗?我需要一个php语句,如果在上周内创建了sql记录,它将显示一个图像。
我的网站有一个配置文件页面设置,我希望在所有最新记录上显示一个新图标
我的数据库上有一个日期戳字段,叫做日期
有人能帮助吗
感谢
这与检查mySQL记录是否在最后x秒内添加基本相同
$stmt = "SELECT * FROM yourtable WHERE `date` > (now() - interval 7 DAY)";
$result=mysql_query($stmt);
foreach($result as $rec){
echo "<img src='"yourimage.jpg'" />";
//do some more stuff with the mysql result if required
}
if ( (strtotime($row['date'])+7*86400)>time() )
echo "<img src='"new.jpg'" alt='"new'" />";