I have two tables that I have joined, on my controller I got
$criterias = new CDbCriteria();
$q = $_GET['q'];
$criterias->join='RIGHT JOIN ECCategory AS b ON b.ID = t.CategoryID';
$criterias->select=array( '"t".*',
'"b"."Name" AS "cName"',
'"b"."ID" AS "cID"',
);
$criterias->compare('t.Name', $q, true, 'AND');
$criterias->compare('b.Name', $q, true, 'OR');
$criterias->compare('t.Spec1', $q, true, 'OR');
$dataProvider=new CActiveDataProvider("ECProduct", array('criteria'=>$criterias));on my ECProduct model I have
public $cName; // for the ECCategory Name public $cID;
and
'category' => array(self::BELONGS_TO, 'ECCategory', 'CategoryID'), // CategoryID = FK
That's how I joined them, now if I search anything I get the results I want only the last page always duplicates. Say my search hits 11 results, it will give me 2 pages. The 1st page with the 1st 10 the 2nd page will show the 11th and repeats 1-9 making each page have 10 results. So unless I get results in 10s 20s...60s etc I will get duplicates on the last page. I tried various joins like FULL, LEFT etc but all the same.
The closest solution I can think of is setting a totlaItemCount=>$count, that way it will give me a fixed amount. The only problem is how do I count the numbers of item returned from a search query before it's displayed?
Thanks

Help














