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?

Add % to $REQUEST value used SQL Query
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Add % to $REQUEST value used SQL Query
#47147
Add % to $REQUEST value used SQL Query 10 Years, 6 Months ago Karma: 0
Hi,

I am trying to use the values from a $REQUEST variable to build the SQL Query statement and I have the Query operating fine. The question is what is the best way to add a "%" to the end of the passed $REQUEST value to ensure the query finds all instances rather than only an exact match?

My query WHERE currently is as follows,

WHERE
({$REQUEST:vLocCountry|empty:""} = '' OR LocCountry LIKE {$REQUEST:vLocCountry|empty:""})

The obvious answer for me appears to be to add the "%" to the value on form entry, but the form seems to not permit the use of "%" and generates an error on the webpage. Any ideas? Even if there is an easy way to force the form to accept the "%" character.

Thanks in advance.

Ken
The administrator has disabled public write access.
 
#47149
Re:Add % to $REQUEST value used SQL Query 10 Years, 6 Months ago Karma: 748
Hello,

Use the following code:

WHERE
({$REQUEST:vLocCountry|empty:""} = '' OR LocCountry LIKE CONCAT('%',{$REQUEST:vLocCountry|empty:""},'%'))

Regards,
ARI Soft
The administrator has disabled public write access.
 
#47186
Re:Add % to $REQUEST value used SQL Query 10 Years, 5 Months ago Karma: 0
Thanks very much, your suggestion worked great!

Ken
The administrator has disabled public write access.
 
Go to topPage: 1