//判断是否超过了 数量
if(!$_GET['id']){
$sellnum = 3;
//取用户已发房源
$where = ' and consigner_id = '.$member_id;
$where .=" and status <> 7";
$sellCount = $houseSell->getCount(0,$where);
//比较房源数量
if($sellnum <= $sellCount ){
$page->back('你正在出售的房源已经超过了'.$sellnum.'条,请把无效的房源下架后再发布新房源!');
}
}这里是发布条数总数为3。 每个ID只能发3条我现在想改成每个ID每天可以发5条,总条数受限制比如100。

解决方案 »

  1.   

    弄个一时间的判断,只要过了第二天 就把 $sellnum = 3;
     这个变量重新置为5     然后发一条 减少一条???貌似还是怪复杂的哦。。
      

  2.   

    你看看你数据库今天的该id的记录有几个
    如果大于3,就不让发,通过第一个了,再去检查一下,该id的总记录是多少条
    如果大于100,也不让发.
      

  3.   

    if(!$_GET['id']){
            $sellnum = 5;
            $countnum = 100;
            //取用户已发房源
            $where1=$where = ' and consigner_id = '.$member_id;
            $where .=" and status <> 7";
            $sellCount = $houseSell->getCount(0,$where);
            //比较房源数量
            if($sellnum <= $sellCount ){
                $page->back('你正在出售的房源已经超过了'.$sellnum.'条,请把无效的房源下架后再发布新房源!');
            }
           $Counts = $houseSell->getCount(0,$where1);
            //比较房源数量
            if($countnum <= $Counts ){
                $page->back('你发布的房源已经超过了'.$countnum.'条,请把无效的房源下架后再发布新房源!');
            }    }
      

  4.   

    $todaytime = strtotime(date("Y-m-d",time())." 00:00:00");
    $where .=" and `time`>= $todaytime";//把`time`改为对应的发布时间的字段名
    不知道status <> 7是干什么用的?
      

  5.   

    status <> 7, 这个不影响,这个是判断房源是出售中还是下架或者是已经成交的状态
    我数据库里面的时间字段是  created  是秒的形式显示  1274163304 怎么能实现每天可以发布5条呢?  老大能不能把代码写具体点呢?谢谢
      

  6.   

    if(!$_GET['id']){
      $sellnum = 5;
      $countnum = 100;
      //取用户已发房源
      $where1=$where = ' and consigner_id = '.$member_id;
      $todaytime = strtotime(date("Y-m-d",time())." 00:00:00");//这里要注意时差
      $where .=" and `created`>= $todaytime and `status` <> 7";  $sellCount = $houseSell->getCount(0,$where);
      //比较房源数量,当天
      if($sellnum <= $sellCount ){
      $page->back('你正在出售的房源已经超过了'.$sellnum.'条,请把无效的房源下架后再发布新房源!');
      }
      $Counts = $houseSell->getCount(0,$where1);
      //比较房源数量,总数
      if($countnum <= $Counts ){
      $page->back('你发布的房源已经超过了'.$countnum.'条,请把无效的房源下架后再发布新房源!');
      }  }