Jump to content

using an array with like??


mapleleaf

Recommended Posts

No. You will have to use OR like so:

 

SELECT * FROM table WHERE col LIKE '%something%' OR col LIKE '%somethingelse%'

 

If you have an array containing terms you want to use with LIKE you can do something like this:

 

$terms = array(
'term1',
'term2',
'term3'
);
$sql = "SELECT * FROM table WHERE col LIKE '%" . implode("%' OR col LIKE '%", $terms) . "%'";

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.