Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Help > PHP Programming Help

PHP Programming Help Post any question relating to PHP Programming here and hopefully someone can help.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 2008-03-22, 12:29 AM
Junior Member
 
Join Date: Mar 2008
Posts: 0
BATMan_Phln is on a distinguished road
Default Sorting records by user preference

I'm a novice at this but I can understand SOME of it so go easy on me.

I have a page that displays record from a database. Some fields are...
Name
Church
Title
State
etc.

I want to put a drop down at the top of the page so the user can sort the records by any of those fields. I had another page set up that would accept a $_GET and show records by category. (A friend wrote the code, not me)

mysql_select_db($db_name);
$query="SELECT * FROM members WHERE category ='" . mysql_escape_string ($_GET[category]) . "' ORDER BY company";
$result=mysql_query($query) or die (mysql_error());

Instead of getting the records just by a field I want it to show all of the record but use the ORDER BY and sort them as stated above. Something like ORDER BY ($_GET[user chosen value]) I would guess. Is this possible?

Thanks,
BATMan
Reply With Quote
  #2 (permalink)  
Old 2008-04-14, 01:36 AM
Junior Member
 
Join Date: Apr 2008
Location: Cheltenham, UK
Posts: 11
hoopyfrood is on a distinguished road
Default CAN BE FIXED: sample would do :)

Hi BATMan_Phln,

the good news is: yes, it can be achieved. The bad news: a bit more code wouldn't do any harm.

A sample of your PHP would help a great deal.

Till then,
hoopyfrood
__________________
Love your documents!

DocuView - The best Web 2.0 document management system (DMS) - utilising the latest technology to help your company achieve ISO 9001 certification.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:06 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.