php - sqlite with mulitple like -
i trying set query php , sqlite , query has multiple conditions...
$findme = 'blah'; $nlast = -1; $nrecord = 5; $db = new pdo('sqlite:data.db'); $qry = "select * mytable (id > $nlast) , ((col1 '%$findme%') or (col2 '%$findme%') or (col3 '%$findme%') or (col4 '%$findme%')) limit $nrecord order id desc"; $result = $db->query($qry);
...but not return results. if run query 1 of conditions work.
any thoughts?
why not try using glob
instead of like
?
select * "mytable" ('col1' || 'col2' || 'col3' || 'col4') glob '%$findme%'
Comments
Post a Comment