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
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
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.