Matthew, Apologies to others that this is now quite OT, let's make this the last of this thread. If I may suggest that this is now about pure sql techniques and nothing to do with php.
What I did was to create a table (not temporary as it happens) with fields containing all the fields that you want to display e.g.: CREATE TABLE searchdata ( username varchar(30), course varchar2(80), discipline varchar2(40), college varchar2(60)); CREATE INDEX course ON searchdata (username, course); CREATE INDEX discipline ON searchdata (username, discipline); CREATE INDEX college ON searchdata (username, college); The username field is either the name the user is logged in as or some unique identifier you give to that user. When you get the main sql statement, copy all the fields into searchdata. When you display the fields on your form, make each of the headings of the table you display the data in a url to this same form but with an "orderby" parameter. So e.g. the "course" column title is a url ending in "orderby=course". Now when the form is called with the orderby parameter, instead of getting the data from the main table, get it from searchdata with an sql statement which includes the relevant "order by" clause. You need to arrange for the data to be deleted when it is finished with, I leave that to you, each case will differ. I do not claim that this is the best way, but it is the way I used. Hope it helps. Chris Matthew K. Gold wrote: >I'm sorry to trouble you further, but if you have a second, can you give me >some advice on how to store results in a temporary table with the columns >indexed? I'm very new to PHP, and I'm not sure how to go about it. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php