i have an array, that can contain different values for example: Array ( [0] => Allgemeine Pharmazie [1] => Geriatrische Pharmazie )
The WordPress DB contains in the meta_value the following array: a:4:{i:0;s:20:"Allgemeine Pharmazie";i:1;s:22:"Geriatrische Pharmazie";i:2;s:16:"Fachassistent*in";s:8:"other_16";s:8:"Tierarzt";}
I want to get the user_id of the ones that have the array values in the DB.
I tried out the solution from this question PHP/MySql search array with array
$zuqual = $this->userInput["Zuquali"];
$imploded = (implode(",", $zuqual));
print_r($zuqual); //output Array ( [0] => Allgemeine Pharmazie [1] => Geriatrische Pharmazie )
if(!empty($zuqual)){
$result = $this->wpdb->get_col($this->wpdb->prepare("SELECT user_id FROM wp_usermeta WHERE meta_key='addition_qualification' AND meta_value IN ('".$imploded."')"));
}
var_dump($result);
But i only get empty results, also I think its not the correct query, because i want the user_id if the array elements (Allgemeine Pharmazie and Geriatrische Pharmazie) are found in the meta_value right?
Thanks in advance for your help :)