![]() |
|
#1
|
|||
|
|||
Sorting columns by selectionHi,
I'm new to PHP so need a bit of help. I am setting up a simple site which lists job numbers, client names, date for completion, etc. I have set up the database, login, and table repeats. However, I would like to be able to allow the users to sort the columns by clicking on the column text/headers - for example if you click client name it will sort the whole table listing the client names from A-Z. I've tried loads of different ways, but like I say I'm new to PHP so just guessing really. Does anyone have some sample code I could use or any suggestions? Thanks, Dean PS: I tried to sort the table using ORDER BY xyz command - where I wanted the xyz to be a URL variable. I thought I could then use links such as .php?sort=client, .php?sort=date, etc. Is this possible in PHP as I could only receive errors - due to my inexperience in php!! Help!! |
|
#2
|
||||
|
||||
|
Here's a part of a script I use
Since you are new to PHP I've removed some special security stuff, just to make it simple PHP Code:
you can use it like: .php?sort=name&how=ASC or: .php?sort=name&how=DESC you can also change 'sort=' value |
Recent GIDBlog
First week of IA training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sorting a 2D array c++ | mike3340 | CPP / C++ Forum | 4 | 15-Dec-2003 13:35 |
| vector sorting | gotnospoon | CPP / C++ Forum | 0 | 10-Nov-2003 15:26 |
| Sorting A Function | misunderstood | MySQL / PHP Forum | 1 | 02-Oct-2003 08:44 |
| SORT / ORDER BY multi columns in MySQL | misunderstood | MySQL / PHP Forum | 3 | 01-Oct-2003 09:01 |
| Opinions Wanted: do 2 columns or 3 look best for this site layout? | jps0 | Websites Reviewed Forum | 10 | 20-Aug-2003 15:30 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The