选择所有相应的数据

I want to select all products with that brand id but only one is coming.

model code

public function get_product_by_brid($id)    {       
  $this->db->select('*');
  $this->db->from('product p'); 
  $this->db->join('category c', 'c.CategoryId=p.CategoryId', 'left');
  $this->db->join('brand s', 'p.BrandId=s.BrandId', 'left');             
  $this->db->where('p.BrandId',$id);        
  $query  $this->db->get();
  return $query->row();     
}

controller code

public function ajax_delete($id)
{
    $brand = $this->brand->get_by_id($id);

    $productsunderbrand = $this->brand->get_product_by_brid($id);
    echo "<pre>";
    print_r($productsunderbrand);
    exit();
    $this->brand->delete_by_id($id);
    echo json_encode(array("status" => TRUE));
}
return $query->row();  

return row will only return you one result.

try

return $query->result();  

or

return $query->result_array();