On Thursday 28 March 2002 22:34, Sebastian A. wrote:
> How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For
> example say I wanted to list all my users alphabetically. How would I do
> this? Or say I had a form and I wanted to present the content to the user
> *AFTER* they have filled it out so that they can check for mistakes.
> Mysql_fetch_row() returns all the rows in a field, so I would guess that I
> have to sort using PHP. Can anyone provide me with an idea as to how I
> could accomplish this?

1) This type of question should best be posted to the php-db list.

2) Sorting should best be done from mysql using the ORDER BY clause:

  SELECT this, that, the, other 
    FROM table
   ORDER BY that

3) If you insist on sorting in PHP then read all the rows from your query 
into an array and use one of the array sort functions -- asort() etc.

Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

Things are more like they used to be than they are now.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to