Re: Screwing up my results...please help
| From: | Marek Kilimajer | Date: | Wed, 22 Oct 2003 21:16:38 +0000 |
| Subject: | Re: Screwing up my results...please help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167176@lists.php.net to get a copy of this message | ||
I hope you check all user inputs for validity. Your order clause should be "order by custno, $TheOrder".
Ryan A wrote:
Hi, I have a search form that queries the database and returns results in this order: company name1 1plan 1 1plan 2 etc company name2 2plan 1 2plan 2 etc company name3 3plan 1 3plan 2 etc etc etc This is my sql: $sqlle = "select * from $table_namee where price <=$max and spacee >=$min order by custno,price LIMIT $limitvalue1, $limit"; So far no problems at all, now I want to add an option so that the visitor has more control of the results...right now its sorting by $price, I have made a drop down menu where the visitor can sort on 7 differient fields, this is my sql: (I have added $TheOrder so it can change according to what was selected. (Eg. Price, name, company, website etc) $sqlle = "select * from $table_namee where price <=$max and spacee >=$min order by $TheOrder, custno LIMIT $limitvalue1, $limit"; This is screwing up my results totally, its giving me something like: company name1 1plan 1 company name2 2plan 1 company name1 1plan 2 company name3 3plan 2 company name2 2plan 2 etc How can i offer the above and still get my results neatly done (like before) by company/custno? Any ideas? Any help appreciated. Cheers, -Ryan