I'm attempting to take a query from a mysql database, turn it onto an array, arrange it alphabetically, then display it on a page.
I've been able to acheive everything except the alpha order part, using the following code:
<?
$link = mysql_connect("$mysql_host", "$mysql_login", "$mysql_password")
or die("Could not connect");
mysql_select_db("$mysql_database")
or die("Could not select database");
$query = "select row from table";
$result = mysql_query($query) or die("Database Error: Query Failed!");
while ($row = mysql_fetch_array($result)) {
?>
<a href="index.php?mem=<? print "".$row[0].""; ?>" ><? print "".$row[0]."";?></a><br>
<?
}
?>
I understand that in order to get it into alpha order, you have to convert the query to an array first, and then use asort (I belive) to sort the array before displaying them all. But how in the heck do I display the array now?
$query = "select row from table";
$result = mysql_query($query) or die("Database Error: Query Failed!");
$result = mysql_fetch_array($result);
asort($result);
while ( ? ) { ? }
I know you probably think I'm a moron. Well, I am. Any help would be greatly appreciated.