There are some tags in my table that has (%) such as: %tag
OR tag%
I am using PDO prepared statement, my problem here is if I need to escape %
or leaved it like this:
$query = "SELECT * FROM table where tags like :tags";
$tags = 'tag%';
//or
$tags = 'tags\%';
$sth->prepare($query);
$sth->bindValue(":tags", '%'.$tags.'%');
UPDATE:
The column value is test%test
when I search for test%test
using: LIKE %test%test
its ok without escape, but I want to find all tags that contains % so when I used %%%
without escape it shows all results even if the column not contain %