Jump to content

[SOLVED] Listing foreach() list in a certain order?


djfox

Recommended Posts

Here`s my code:

 

<?php
$res = mysql_query("SELECT bought FROM userdata WHERE id='$logged'");
$a = mysql_fetch_row($res);
$it = explode(",", $a[0]);	

foreach ($it as $th) {
$res2 = mysql_query("SELECT id, shortname, type, name, cost FROM clothing WHERE id='$th'");
$b = mysql_fetch_row($res2);
mysql_free_result($res2);

echo "$b[3] <br>";
}
?>

 

I want the end results to be listed in the order of the id numbers (listed in both as $b[0] and $th). How do I tell my code to list the results in numerical order?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.