Sorting an Array

I’m drawing values from a database, and inserting them into an array (formatted how I want them exported. I want to then print out this array in alphabetical order by the names of the entries in the array $array["*"] = stuff; I want it alphabetized by the value where the * is <–

I have read through some stuff on PHP.net and all I could manage to make it do was reverse the order of the array. Here is the code that I have come up with after reading on PHP.net for a while. It doesn’t work. Can someone please tell me why?


	$results = mysql_query("SELECT * FROM orders", $myLink);
	while($row = mysql_fetch_row($results)) {
		$theNames["$row[3]"] = "<option value=\"$row[1]\">$row[3], $row[4]</option>
";
	}
	
	arsort($theNames);
	reset($theNames);
	while (list($key, $val) = each($theNames)) {
		echo "$val
";
}

Thanks :slight_smile: