My case is as follows: Inside a foreach I download the contents of a mysql query and assign it to a variable $ preferences (it is a series of numbers, in this case 7 and 8 with an echo print 78)
then I want to use that variable to put it as part of a where condition of a query (where user_id in (7, 8)). I need to extract the contents of the variable $ preferences How can I get it out and separate them by commas? Up to now I have tried the following, but I still can not get the foreach variable to use it in the query:
foreach($filaCRUD as $fila){
$preferencia=", ".$fila->por_usuario_id;
echo "<td><strong>".$preferencia."</strong></td>";
}
in advance, thanks for your help.