Re: Question: Sorting through table headers?

From: Date: Mon, 14 Sep 2009 09:55:20 +0000
Subject: Re: Question: Sorting through table headers?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-298002@lists.php.net to get a copy of this message
Jim Lucas wrote: > Parham Doustdar wrote: >> Hello there, >> I've been asked to create something like the tables you usually see, >> where the headers are actually links and when you click the links, the >> table gets sorted based on the header. Are there any classes that you >> know of that would do the job? My current idea is to return an array >> of the colomn which contains the data you want to sort on (like >> 'name') then sort the array and do something like: >> [code] >> for (i = 0; i < length(array); i++) >> mysql_query("select * from table where 'name' = ${aray[i]}"); >> [/code] >> Any better algorithms anyone? >> Thanks! > > My suggestion would be to have the client do it. > > http://www.js-vault.us/iscripts/007.html > > I use it on a number of different pages. This could be done clientside if you intend to show all data. If you want to implement paging too, you have to do it on the server though.

« previous php.general (#298002) next »