WHERE with explode

0

How do I do a where with explode? I have a variable with the values " 5100 5101 / 5102 " and so it goes, I wanted to list the post with the ID of that variable

    
asked by anonymous 26.08.2018 / 15:54

1 answer

1

You can work out as follows:

$var = "5100/5101/5102";
$var = str_replace("/", ",", $var);
$consulta = "SELECT * FROM tabela WHERE campo IN ('$var')";

Using the WHERE IN field, you can return the desired id's according to your database.

    
26.08.2018 / 16:08