RE: [PHP] Newbie with sorting problem

From: Date: Tue, 06 Jan 2004 12:43:00 +0000
Subject: RE: [PHP] Newbie with sorting problem
Groups: php.general 
Request: Send a blank email to php-general+get-173842@lists.php.net to get a copy of this message
[snip] $result = mysql_query( "SELECT id, name, surname, address FROM addresses"); This scripts works, but.. my desire is now to be able to sort the output, wich is generated by the 'while' loop, for instance on 'name', or on 'surname' . [/snip] Do it in the query "SELECT id, name, surname, address FROM addresses ORDER BY name" "SELECT id, name, surname, address FROM addresses ORDER BY surname" etc. You can sort the array too, but the database in perfectly equipped to perform the sort much more efficiently.

« previous php.general (#173842) next »