I there a way I can return several rows by using a foreach in PHP ?
Example:
I want to loop into the Users table and I have this list of Users id's.
$users = "1,2,3";
foreach ($users as $user) {
SELECT * FROM Users where id = :user;
}
But here, I need the query the db 3 times.
Is there a way to make it in one query ?
Thanks.
SELECT * FROM Users WHERE id IN (1,2,3)then use your foreach to loop the result