php - MySQL REGEX with prepared statement: "?" being misunderstood -


i've consulted this question problem, couldn't seem see answer.

i have prepared statement ? placeholder param i'm binding. problem is, mysql doesn't seem because it's inside regex block, so:

$sql = 'select id teams name regexp "^(?)"'; $stmt = $db->prepare($sql); $stmt->bind_param('s', implode('|', $letters)); 

this throws:

"got error 'repetition-operator operand invalid' regexp" 

is there way of escaping ? or something?

[edit]

based on comment below, tried:

$sql = 'select id teams name regexp "^(:letters)"'; $stmt = $db->prepare($sql); $stmt->bind_param(':letters', implode('|', $letters)); 

now error

"warning: mysqli_stmt::bind_param(): number of elements in type definition string doesn't match number of bind variables" 

interestingly, note i'm using bind_param() php docs say bindparam(). me, latter undefined method.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -