我有这个小代码,我知道我从数据库中收到了很好的信息,因为我做了一些 print_r 并且工作正常:
//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!!