You can always query the database and store the results as arrays in the
session and sort the arrays...this would limit how many times that you
are querying the database (if you are just sorting the results).

--
ray

On Wed, 2003-10-22 at 15:02, 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to