Fat free Framework Parameterized queries LIKE

13 Views Asked by At

I'm trying to get a query with a LIKE comparison going in Fat Free Framework.

$db->exec('SELECT * FROM ideas WHERE name LIKE %:idea%',array(':idea'=>$idea));

That's the query.

The error I'm getting is

PDOStatement: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%'unit'%' at line 1`

Seems like the prepared statement inserts quotes between the placeholders (%), which leads to an error. Can I somehow write this in another way or prevent the quotes from appearing?

0

There are 0 best solutions below