Get ready for BLACK FRIDAY shopping starting in

Forums

PHP

This topic is locked

Search Query and Sort Query

Posted 10 Jan 2010 02:47:49
1
has voted
10 Jan 2010 02:47:49 Heather V posted:
How may I be able to:

#1 Create a Sort from a Query with a series of Headings


#2 Create a Search box and code to Search within a query of results?

Replies

Replied 15 Jan 2010 19:08:33
15 Jan 2010 19:08:33 Alan C replied:
#1
not sure just what you meant, but I think it's a page that has columns of results and clicking on the heading sorts by that column either ascending or descending.

Couple of ways to tackle this, one is to have a separate select and sort coded up for each column, then link to each of those scripts from the table headings - messy and will need a lot of maintenance in the future.

Better - make the headings into links that have url parameters added to the url of the current page, then when it's reactivated look at the parameter that is passed in and use it to modify a select/sort query, and don't forget to do some verification of the parameter before anything else to prevent attacks.
You can toggle the sort direction with this too.

Reply to this topic