Jump to content

[SOLVED] select query help (use of like to find stuff)


kr3m3r

Recommended Posts

Hi guys, I'm trying to search my database for any rows in which one of the columns has part of the search term.

It goes something like this:

Search term foo.

 

Select * from Library_Asset where UPC like %"foo" or Title like %"foo" or MajorAttribute like %"foo" or SecondaryAttribute like %"foo";

 

The php code I wrote is:

$query = "select * from Library_Asset where UPC like '%".$searchterm."%'" or Title like '%".$searchterm."%'" or MajorAttribute like '%".$searchterm."%'" or SecondaryAttribute like '%".$searchterm."%'";

 

Which I'm pretty sure is awful.  So any help you guys can give me would be incredibly appreciated.

Thanks for your time

-Robb

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.