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


Recent Events
  • 23/11/2024 Black Friday 2024

    BIG SALE, 30% discount for all our extensions. Use BF24 coupon code. Hurry up the discount is valid till 3 December.

  • 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.


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, 10 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, 10 Months ago Karma: 760
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, 10 Months ago Karma: 0
Thanks very much, your suggestion worked great!

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