I am very new to MYSQL and Prepared Statements. I have a few queries that I need to change to prepared statements. The problem is with this REGEXP query:
$objects = mysql_query("SELECT * FROM $table WHERE parent REGEXP ',".
$item .",|^". $item .",|,". $item ."\$|^".
$item ."\$'") or die(mysql_error());
How do you go about converting that to a prepared statement with place holders?
You should make use of the CONCAT function inside the prepared statement query instead of using the classic . concatenation sign for regular queries. This should do the trick :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.