在将绑定的语句发送到oracle时遇到问题
我下面的PHP可以正常工作,
$queryString = $_POST["searchText"];
$string = "SELECT * FROM ".$GLOBALS['tableOwner'].".".$GLOBALS['inventoryTableName'] .
" WHERE lower (". $_POST["searchCol"] .") LIKE '%".$queryString."%'";
$statement = oci_parse($conn, $string);
但是当我尝试将其转换为绑定语句时,它什么也不返回
$queryString = $_POST["searchText"];
$string = "SELECT * FROM ".$GLOBALS['tableOwner'].".".$GLOBALS['inventoryTableName'] .
" WHERE lower (". $_POST["searchCol"] .") LIKE '%:qString%'";
$statement = oci_parse($conn, $string);
oci_bind_by_name($statement, ":qString", $queryString)
我错过了什么,这导致它无法正常工作?
EDIT ================
bind不适用于LIKE关键字 必须像这样格式化字符串:
$string = "SELECT * FROM ".$GLOBALS['tableOwner'].".".$GLOBALS['inventoryTableName']." WHERE lower (". $_POST["searchCol"] .") LIKE '%' || :qString || '%'";