SELECT * FROM `weibo_logs` where DATEDIFF( NOW(),date)=0 order by `date` desc limit 1
查询符合条件的weibo_user_id每天的一条数据
SELECT weibo_user_id, DATE_FORMAT(date,'%Y-%m-%d') FROM `text` where 'weibo_user_id'='{$source_account->id}' GROUP BY DATE_FORMAT(date,'%Y-%m-%d')
这样会有排序问题,那么就先排序
SELECT DATE_FORMAT(date,'%Y-%m-%d') as d
FROM (SELECT * FROM `text` ORDER BY date DESC) as s
where 'weibo_user_id'='{$source_account->id}'
GROUP BY DATE_FORMAT(date,'%Y-%m-%d')
每个选项上加超链接,如<a href="?c2=all">选项一 全部</a>
<a href="?c2=7">选项二 c2为7</a>
php中用get方式获取$c2=$_GET['c2']然后
if($c2=='all' || c2=='')
$sql='select * from 表名'
else
$sql="select * from 表名 where c2=$c2"
接着执行sql,获取结果并显示
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)