I am new to mySQL and PHP, so bear with me.
How can I make it so that if my query has duplicate fields, the data retrieved would have repeated data for the repeated query fields.
An example would be like:
query for id = 34, 54, 21, 21, 50 (already in the order I want them to be in)
I want the database to return
user_icon for id = 34, user_icon for id = 54, user_icon for id = 21, user_icon for id = 21, and user_icon for id = 50.
And not just one data returned for the duplicate id 21.
Here is the code I am using at the moment:
$thumb = "SELECT thumbnail from users WHERE id IN (".$idsearch.") ORDER BY FIELD(id , ".$idsearch.")";
$search = $con->prepare($thumb);
$search -> execute();
$pics = $search->fetchAll();
foreach($pics as $pic) {
$thumbnail[] = $pic['thumbnail'];
}
Thank you for the help!