PHP头条
热点:

关于php的判断语句,该怎么处理


关于php的判断语句
	$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;
}


以上判断一个会员在一天内只能提交一篇文档,想修改成可以提交3篇,应该怎么做? 分享到:
------解决方案--------------------
原代码改为
$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;
}

www.phpzy.comtrue/phprm/1565.htmlTechArticle关于php的判断语句,该怎么处理 关于php的判断语句 $pubdate=$dsql->GetOne("selectpubdatefromarticlewherewriter='".$writer."'orderbyiddesclimit1"); if((time()-$pubdate['pubdate']) ShowMsg("对不起,一个会员每天只能发...

相关文章

相关频道:

PHP之友评论

今天推荐