I have this code to insert data into an array called $usersEmails
:
while($get = mysqli_fetch_assoc($query_run)){
$userOne = $get['UserOne'];
$userTwo = $get['UserTwo'];
if($userOne != $id){
array_push($usersEmails, $userOne);
}else if($userTwo != $id){
array_push($usersEmails, $userTwo);
}
}
Then I have made a query using this array:
$query = 'SELECT `Email` FROM `users`
WHERE `Id` IN ('.implode(',', array_map('intval', $usersEmails)).')';
This code generates results ordered by users.Id
, but I want these IDs to be ordered in the same order as they appear in my array.
In other words, I want the IDs to be output from 0 --> end of array