I am working with codeigniter and i want to fetch recods as "two arrays" based on condition (FilterType='Tag',FilterType='Merchant')
Here is my table "filterproducts"
id FilterType CategoryUrl
1 Tag abc
2 Tag xyz
3 Merchant abc
4 Merchant abc
Here is my current code which is giving me multidimenional array
function SearctRecords()
{
$this->db->select("*")
->from("filterproducts fp")
->join("filterid fi", "fp.FilterType=fi.name")
->where("fp.CategoryUrl", $CategoryUrl);
$query = $this->db->get();
$result = $query->result_array();
return $result;
}
Here is my controller
function SearchFilterProducts()
{
$users['data'] = $this->Customer_model->SearctRecords($CategoryUrl);
$responseJSON = array("Status" => $status, "data" => $users['data']);
header("content-type:application/json");
$response = json_encode($responseJSON);
echo $response;
}