0
How do I make a Where with explode? I have a variable with the values "5100/5101/5102" and so it goes, I wanted to list the posts with the ID of this variable
0
How do I make a Where with explode? I have a variable with the values "5100/5101/5102" and so it goes, I wanted to list the posts with the ID of this variable
1
You can elaborate as follows:
$var = "5100/5101/5102";
$var = str_replace("/", ",", $var);
$consulta = "SELECT * FROM tabela WHERE campo IN ('$var')";
Using the WHERE field IN, you can return the desired id’s according to your database.
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
I modified some parts and it worked, but can you take away a doubt? if you have many ID, can you leave the page heavy?
– Rogério Silva