I’ve this small code, I know I receive fine from the database because I made some print_r and work fine:
//build query SQL
$query = $this ->select()
->where('numBedrooms=?',$numBedrooms)
->where('type=?',$type)
->where('state=?',$state)
->limit(8);//8 rows, with an offset of $recent_page*8-8
//execute query SQL
$rows=$this->fetchAll($query);
//encode json
$var= json_encode($rows);//-------->var is empty always!!
If fetchAll() is returning an object like you say it is, then it would be wise to first convert this to an array and then to pass it to json_encode. I do not believe json_encode work’s with objects.