为什么输入那个空时显示数据库‘customer’
中的所有数据?
我希望输入为空num_rows == 0
。
search_customer = 1;//$this->input->post('search_customer');
$query = $this->db->where('id', $search_customer)->or_where('name', $search_customer)->get('customer');
if($query->num_rows()==0){
echo '0';
}else{
$data = array();
foreach ($query->result() as $row)
{
$data[] = $row;
}
echo json_encode($data);
}