Re: How to sort numerically ?
| From: | Laercio Fortes | Date: | Sat, 24 Mar 2001 12:21:17 +0000 |
| Subject: | Re: How to sort numerically ? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7750@lists.php.net to get a copy of this message | ||
Dear Sunil,
First of all make an array of you are reading from file.
Like that:
<?
$sel = "Selcect fild1,fild2 from myfile";
$res= mysql_query($sel);
while ($row=mysql_fetch_row($res))
{
$my_array[$row[0]] = $row[1];
}
// tem:
asort($my_array);
for(reset($my_array); $ind=key($my_array); next($my_array))
{
print ("$ind : $my_array[$ind] <br>");
}
?>
Sunil Jagarlamudi wrote:
> I am trying to read a file which has two columns with names and numbers and
> I am trying to sort them numerically, with the
> highest at the top. Is there anyway you can do that in php ?
>
> Thank You
>
> Sunil
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net