How can I sort this array by city or by id in descending order?
if ($num > 0 ) {
$i=0;
while ($i < $num) {
$city = mysql_result($result,$i,"city");
$state = mysql_result($result,$i,"state");
$id = mysql_result($result,$i,"id");
echo "$city";
echo "$state";
++$i; } } else { echo "No results."; } ?>
You didn’t include your SQL code in the above post, but that is the part of the code where you are supposed to add the ORDER BY sorting function as follows:
SELECT * FROM address_table ORDER BY city desc