Re: php & sorting rows

by Kevin Waterson <kevin(at)oceania.net>

 Date:  Thu, 30 Jan 2003 12:44:34 +1100
 To:  hwg-techniques(at)mail.hwg.org
 References:  localhost
  todo: View Thread, Original
This one time, at band camp,
franic(at)qis.net wrote:

> Hello all,
> 
> I have come to a dead stop and can't for the life of me figure out how to 
> do this. I am pulling rows from a database and printing them out in a 
> nice table. That works fine. What I can't figure out is how to sort the 
> rows by one of the items in the row. The page is here - 
> http://www.mdpta.org/membership/lifemembers/garrett.phtml and the 
> php I am using is here - http://www.dragonflyweb.com/lifemem.txt. I need 
> to sort according to $lname

Let the database do the work for you..

$sql="SELECT * FROM <tablename> ORDER BY '$lname'";
mysql_query($sql) or die(mysql_error());


-- 
 ______                              
(_____ \                             
 _____) )  ____   ____   ____   ____ 
|  ____/  / _  ) / _  | / ___) / _  )
| |      ( (/ / ( ( | |( (___ ( (/ / 
|_|       \____) \_||_| \____) \____)
Kevin Waterson
Port Macquarie, Australia

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA