How do you sort php and sql arrays?

Posted by Jon on Stack Overflow See other posts from Stack Overflow or by Jon
Published on 2010-06-03T02:44:51Z Indexed on 2010/06/03 2:54 UTC
Read the original article Hit count: 274

Filed under:
|
|
|

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."; } ?>

© Stack Overflow or respective owner

Related posts about php

Related posts about sql