Jump to content

[SOLVED] Help Me Modify this MySQL Query


webref.eu

Recommended Posts

Hi All

 

I have the following MySQL query: 

 

$query = "select * from Products where (ProductName like \"%$trimmed%\" or ProductBrand like \"%$trimmed%\")  order by ProductName";

 

I want to modify it to include an or ProductDesc like \"%$trimmed%\, so how do I do this? 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/160688-solved-help-me-modify-this-mysql-query/
Share on other sites

You don't need parentheses or to escape the double quotes.  The conventional way is to use single quotes around the pattern.

 

  $query = "SELECT * FROM Products where ProductName LIKE '%$trimmed%' or ProductBrand LIKE '%$trimmed%' or ProductDesc LIKE '%$trimmed%'";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.