sorting an array
Posted: Wed May 14, 2003 6:18 am
Hi,
I've been searching all over for how to do this. I read the online docs from php.net and they are kinda tough to understand. Here's a sample of what my code kinda looks like:
I need to be able to sort $array1 by say "num3" so that it would output something like:
Can anyone help me with this? I hope this is clear enough. I would greatly appreciate it 
I've been searching all over for how to do this. I read the online docs from php.net and they are kinda tough to understand. Here's a sample of what my code kinda looks like:
Code: Select all
<?php
$array1 = array();
while($myrow = mysql_fetch_array($result))
{
$array2 = array(
"num1" => myrow['num1'],
"num2" => myrow['num2'],
"num3" => myrow['num3'],
"num4" => myrow['num4']
);
$array1[$i] = $array2;
$i++;
}
?>Code: Select all
Array1ї0] is 1, 2, 5, 0
Array1ї1] is 1, 2, 4, 0
Array1ї2] is 1, 2, 3, 0
Array1ї3] is 1, 2, 2, 0