$pubdate = $dsql->GetOne("select pubdate from article where writer ='".$writer."' order by id desc limit 1"); if((time()-$pubdate['pubdate'])<(3600*24)){ ShowMsg("对不起,一个会员每天只能发一篇文章!","-1","0",5000); exit; } $pubdate = $dsql->GetOne("select pubdate,writer,count(pubdate) as total from article where writer ='".$writer."' and pubdate if($pubdate['total'])==3){
ShowMsg("对不起,一个会员每天只能发一篇文章!","-1","0",5000);
exit;
}
mysql查询一天内提交的文章数,如果>=3不能提交
$pubdate = $dsql->GetOne("select pubdate,writer,count(pubdate) as total from article where writer ='".$writer."' and pubdate if($pubdate['total'])==3){
ShowMsg("对不起,一个会员每天只能发一篇文章!","-1","0",5000);
exit;
}
mysql查询一天内提交的文章数,如果>=3不能提交
mysql跑不起来。跪求检查一下。
另外:if($pubdate['total'])==3)应该是if(($pubdate['total'])==3)这样吧?
数据库字段:
数据库名称(article)
会员名称(writer)
发布时间(pubdate)
原代码改为
$n = 1; //你指定的篇数$pubdate = $dsql->GetOne("select count(*) as cnt from article where FROM_UNIXTIME(pubdate,'%Y%m%d')=DATE_FORMAT(now(),'%Y%m%d') and writer ='".$writer."' order by id desc limit 1");if($pubdate['pubdate'] > $n){ ShowMsg("对不起,一个会员每天只能发 $n 篇文章!","-1","0",5000); exit;}还是版主给力,学习了
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号