I have this line in PHP that is building a query parameter in PDO:
$p[':criteria'] = '%' . $search . '%';
The line of MySQL in question looks like this:
d.d_name LIKE :criteria
The problem is if I put a number in $search, it's converting it to a character. For example, if I set $search to:
6008
I want it to be:
%6008%
but what I get is:
`08%
It looks like it is %-encoding the 1st 2 characters. I tried using urldecode() to revert it, but it didn't work. It kept the string as `08%.
How can I stop this from happening?