0

I have a string of products I am requesting from a database like this:

$products_string = "706,714,713,715,716,717,720,753,754,781,782,785,710";

and then the mySQL query:

$select_products = $db->query("SELECT product_id, name FROM table_products 
WHERE product_id IN (".$products_string.") LIMIT 0,12");

I then present the products like this:

while($show_products = $db->fetch_array($select_products)){
    // products HTML here
}

The problem is, when they are returned they are sorted by product_id ascending, meaning they are returned like:

"706,710,713..." etc

When I want them returned in the same order as the $products_string.

Is there any simple way to achieve this?

user1227914
  • 3,386
  • 9
  • 39
  • 74

0 Answers0