PHP Prepared Statements... Bind variable as numeric range in REGEXP?
mysql, pdo, php, regex
Solution
Placeholders can only be used where a value can appear, not embedded in strings. Try:
$query = "SELECT * FROM `mytable` WHERE `file` REGEXP CONCAT('[', :val, '-9]')";
Problem
``` $query = "SELECT * FROM `mytable` WHERE `file` REGEXP '[:val-9]'"; $stmt = $dbh->prepare($query); $stmt->bindValue(':val', '1'); //I have also tried 1 without quotes $stmt->execute(); ``` Throws this error: Syntax error or access violation: 1139 Got error 'invalid character range' from regexp Is it possible to do this..