使用环境
近期网站建设中有一个公示时间的功能,时间戳以后的数据不允许显示。这个时候需要用到迅睿SQL查询语句。
具体代码
<?php $query=urlencode("select * from @#1_gongshi where ispay=2 and gssj < UNIX_TIMESTAMP(NOW()) and catid=14 order by gssj desc limit 6");?>
{SQL SQL='$query'}
<li>
<a href="{$t.url}">{$t.title}</a>
<span>dr_date($t._gssj, 'Y-m-d')}</span>
</li>
{/SQL}说明
gssj字段是时间戳形式,UNIX_TIMESTAMP(NOW())为当前时间戳