1
I have an array that will be variable, e.g.: $ref = array('123', '654', '555').
I wanted to make an SQL query to bring the information of these references, something like:
SELECT *
FROM tabela_itens
WHERE ref = (array do PHP)
How can I do that?
The simple query I do, without array, is like this:
$query = ("
SELECT *
FROM tabela_itens
WHERE ref = '123'
");
$db -> setQuery($query);
$results = $db -> loadObjectList();
foreach($results as $row){
echo '<div>'.$row->ref.'</div>';
};
can use
.....WHERE ref IN (value1, value2, ...);
– user60252