$query = \"SELECT * FROM `mytable` WHERE `file` REGEXP \'[:val-9]\'\"; $stmt = $dbh->prepare($query); $stmt->bindValue(\':val\', \'1\'); //I have also tried 1 with
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]')";