Q:

How to bind in PDO a string with %

I have the following query, (which don't work).
How do I bid strings inside an existing string with % (I believe the % is not the problem, but really not sure).  
$sql="SELECT * FROM T WHERE f LIKE '%:bindParamString%'";

A:

You can include % symbols into your value:
 $param = '%'.$param.'%';
 $query = "SELECT * FROM T WHERE f LIKE ?";

Or use SQL to concatenate string in database:
 ## if you have mysql
 $query = "SELECT * FROM T WHERE f LIKE CONCAT('%', ?, '%')";

It also a good idea to use LIKE instead of = then you're searching by patterns.

