What do you mean ORDER BY 'S' ??

yes, it can be a column or combination of columns and data.

What are you trying to DO?

-----Original Message-----
From: Sebastian A. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 10:30 AM
To: PHP General List (PHP.NET)
Subject: RE: [PHP] SQL Question


When you say "ORDER BY that", is it also possible to do that via letters
such as ORDER BY 'S', because from what I understand, ORDER BY has to be a
column.

-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 3:49 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] SQL Question

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


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

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

Reply via email to