mysql PDO how to bind LIKE

Posted by dmontain on Stack Overflow See other posts from Stack Overflow or by dmontain
Published on 2010-04-27T14:40:21Z Indexed on 2010/04/27 14:43 UTC
Read the original article Hit count: 388

Filed under:
|
|
|
|

In this query

select wrd from tablename WHERE wrd LIKE '$partial%'

I'm trying to bind the variable '$partial%' with PDO. Not sure how this works with the % at the end.

Would it be

select wrd from tablename WHERE wrd LIKE ':partial%'

where :partial is bound to $partial="somet"

or would it be

select wrd from tablename WHERE wrd LIKE ':partial'

where :partial is bound to $partial="somet%"

or would it be something entirely different?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about pdo