Before bug fixes, there are a bunch of articles corresponding to a bunch cate, query the list of questions.
Because the table is provided cate field varchar, separated by commas between cate_id, so to use the following like:
where(array('cate_id'=>('like',"%".$cate."%")));
But the finding is not so.
When I cate = 1 when, like check out the 1,10,11,12 .... as long as 1 or without separating can always check out, and cate_id = null still not spared ... Obviously not I want something.
Then think of a find_in_set, well I'd native query, but this involves paging, because it is Tp3.2 framework (although there are 9102 years people use this framework I am also very sweat, but since the source code is not mine development I really do not want to move the bulk of Baidu, TP3.2 how to use this find_in_set bar, Baidu as follows:
But the discovery does not seem to bring such a thing, it becomes a print sql "select * from table where cate_id = 'find_in_set (1, cate_id)'" ..... emmm .... So check out the list is naturally empty.
A pair of line, then I wrote a little complicated to separate
if(!$cate){ $list = $wx->limit($p->firstRow.','.$p->listRows)->where($where)->order('id desc')->select(); }else{ $list = $wx->limit($p->firstRow.','.$p->listRows)->where($where)->where("find_in_set($cate,cate_id)")->order('id desc')->select(); }
Problem Solving -