Reputation: 53
Im trying to make an search function in codeigniter. I have an array with the value of multiple diffrent checkboxes. (groups, times, special etc)
Im first using the keys form te array to make the search array like so
$data = array_keys($data);
$find = array();
foreach($data as $selection){
if(!strpos($selection,'groep') == 0){
$find[$selection] = 1 ;
}
$find[$selection] = 1 ;
}
the result of the array is like this:
Array ( ["fri_morning"] => 1 ["groep_1"] => 1 )
what isnt working is the next bit of code where im trying to use the second array to make multiple where selections for my query
im doing it like this:
$where = '';
foreach($find as $finds){
echo array_keys($finds);die();
$name = key($finds);
$where .= '$this->db->where'.name.','.$finds[$name].')';
};
Im getting the following error
Message: array_keys() expects parameter 1 to be array, integer given
What am i doing wrong/missing here
Upvotes: 0
Views: 466