I have a table named desserts
with ID's, but when I use the IN
clause , it returns a sorted result.
public function getDessertById($id)
{
$stmt = $this->conn->prepare("SELECT * FROM `desserts` WHERE id IN (" . $id . ");");
$stmt->execute();
return $stmt->fetchAll();
}
whenever the id is an array of (55,23,1,5,7,12)
it always returns (1,5,7,12,23,55)