Re: Sorting data alphabetically
| From: | Philip Olson | Date: | Thu, 14 Dec 2000 23:34:20 +0000 |
| Subject: | Re: Sorting data alphabetically | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30392@lists.php.net to get a copy of this message | ||
Hey Ben-
You should look towards the SQL side of things too, not just PHP. A
useful "newbie" SQL tutorial is as such :
http://www.sqlcourse.com/
Pretty much all that you find there you can stick into mysql_query().
Also note that usually if it can be done with the DB (ex. sorting), then
it'll be faster. Regarding your question :) , look into ORDER BY , they
will be in the above tutorial. Actually I just checked, ORDER BY is
covered in the other tutorial (although imho it should be one website) :
http://www.sqlcourse2.com/
Have fun! Oh, note the ASC and DESC differences.
Regards,
Philip
--.sig
[ Want to write Good code? First, write Bad code. ]
On Thu, 14 Dec 2000, Ben Wiechman wrote:
>
> I'm working on a PHP/MySQL solution and I would like to sort the output of
> my select statement in alphabetic order.
>
> I have a table with the following data
> id - int
> parent_id - int
> name - name of item
>
> I would like to sort the data alphabetically by name before I print the data
> to the screen. Is there some way I can do this with my select statement (and
> I tried to rtfm... lol But I'm pretty new to this.) Or am I going to have to
> build the output array in PHP somehow and sort it there?
>
> Ben
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>