Hi Everton one, I have the following search statement that works great, But what I would like to do is expand this to include multiple LIKE '%$search%'

                                    $STM = $dbh->prepare('SELECT * FROM tblname WHERE col=:lsecure');
                                    $STM->bindParam(':lsecure', $search);
                                    $STM->execute();            
                                    $count = $STM->rowCount();
                                    $results = $STM->fetchAll(PDO::FETCH_ASSOC);

What I would like to do is to add something like this to the select query.

WHERE description LIKE '%$search%' AND mcat LIKE '%$search%' AND scat LIKE '%$search%'

Any help would be greatly appreciated,

Member Avatar

The whole search string goes to the execute (or bindValue or bind Param):

$STM = $dbh->prepare('SELECT * FROM tblname WHERE col LIKE ?');
$STM->execute(["%$search%"]);