I have this table:
id sh_id meta_key meta_value
1 1 country 111
2 1 state 10
3 1 city 5
4 2 country 110
5 4 state 11
....
I will pass an array value to the function. and the array contains value like below
$array = array('country_id'=>111,'state_id'=>10,'city_id'=>1);
function getValue($array)
I want to get the result of those array values should match with the meta_key and the meta_value
For example : The query match with the country_id value of the array with the meta_value and the meta_key 'country' as well as state and city
It should be in one query .
I have tried the below query and it's not working
$this->db->where('meta_key', 'country');
$this->db->or_where('meta_value', $array['country_id']);
$this->db->where('meta_key', 'state');
$this->db->or_where('meta_value', $array['state_id']);
$query = $this->db->get("at_featured_shops");