Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DevShed:
Ordering Columns in DDBB Search Results
Dec 07, 2004 @ 13:22:14

New from DevShed.com today, there is an article concerning the use of ordering in a set of DDBB search results.

This article will show you the fastest way to order your database results, via JavaScript (with some work in PHP). It adds some more work to your script, but once you see the results you won't use the approach of adding the ORDER By clause anymore.

[...] I bet most of us have at some point developed an application where a list of products is retrieved from a database and shown in a table with its name, price and code. Perhaps some of us thought: "Hey, let's be nice and give the user the chance to order these results by name or price." Obviously this works, but there is a problem: you must search again in your database, and send the user the whole page with the new results.

Using this method and the addition of a little Javascript to the mix to create a listing that can be dynamically sorted based on any column your user could choose. Not only can this save precious time (that your user would have to spend waiting for it to reload), but it can also be used in conjunction with other features to make a more seamless user environment.

tagged:

Link:


Trending Topics: