Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

[SOLVED] Using a drop down list to change WHERE
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: [SOLVED] Using a drop down list to change WHERE
#30069
[SOLVED] Using a drop down list to change WHERE 11 Years, 9 Months ago Karma: 2
So I need to change my SQL query based on the user's choice in a drop down list.

The list will contain dates.

The query changes based on the date:

SELECT * FROM table WHERE Date={date} ORDER BY f1 DESC, f2 DESC;

So if the user select 2012-Jan-01 from the drop down list, the URL changes to:

www.domain.com/page.php?date=2012-Jan-01

I've read some posts about {$REQUEST}, but I'm having no luck.

Does anyone have help on this approach?
Last Edit: 2012/07/26 03:44 By JugglingReferee.
The administrator has disabled public write access.
 
#30070
[SOLVED] Using a drop down list to change WHERE 11 Years, 9 Months ago Karma: 2
After MANY test queries, trials with fake data, etc, I have the solution:


Code:

SELECT @curRank := @curRank +1 AS Rank, Table1.Name, Table2.TieBreakingField1, Table2.TieBreakingField2, Table2.TieBreakingField3, Table2.TieBreakingField4, Table2.TieBreakingField5
FROM Table1, Table2, (
SELECT @curRank :=0
) r
WHERE Table1.FieldID=Table2.FieldID
AND Table1.LookUpField={$REQUEST:$LookUpField}
ORDER BY TieBreakingField1 DESC, TieBreakingField2 DESC, TieBreakingField3 DESC, TieBreakingField4 DESC, TieBreakingField5;




As you can see, I also have the RANK column as researched in my previous topic.
Last Edit: 2012/07/26 03:38 By JugglingReferee.
The administrator has disabled public write access.
 
Go to topPage: 1