I would like to do a search on mysql using a variable that contains data separated by,. So far I have always done this with a loop, but the same is some way of looking directly using that variable.
The idea would be to find all the ids stored in the database that are in that list.
I have absolutely no code to put a part.
example of data structure:
id = int autoincrement
concepto = varchar
precio = int
and let's call variable $idaconsultar
and content has "1,5,8,14"
The search I would like to do is: consult the data that matches the id in the variable $idaconsultar
, without having to do a foreach
.