diff --git a/application/models/Cage.php b/application/models/Cage.php index a2fd508..6ebff3b 100644 --- a/application/models/Cage.php +++ b/application/models/Cage.php @@ -20,9 +20,9 @@ class CageModel extends Orm_Base{ $cagemodel = new CageSetModel(); $shownum = $cagemodel->field('line_num')->where("c_user_id='{$params['uid']}'")->fRow(); $limmit = empty($shownum['line_num'])?20:$shownum['line_num']*5; - $sql = "select cage.id,cage.number,cage.color,strains.title strains,cage.type from cage left join strains on cage.strains=strains.id where 1 and "; + $sql = "select cage.id,cage.number,cage.color,strains.title strains,cage.type from cage left join strains on cage.strains=strains.id"; if(!empty($params['keywords'])){ - $sql .="cage.number like '%{$params['keywords']}%'"; + $sql .=" where cage.number like '%{$params['keywords']}%'"; } if(!empty($params['order'])){ $sql .=" order by cage.{$params['order']} desc";