如何在 MySQLi 中使用 LIKE?
How to use LIKE in MySQLi?
我有一个代码可以与 MysQl 一起使用,但在 MySQLi 中不起作用:
function CheckBlocked($table, $thisip, $service) {
$sql="SELECT * FROM $table WHERE code = '$service' AND b_contents LIKE '%.$thisip.%'";
$query=mysqli_query($dbconnect,$sql);
$num=mysqli_num_rows($query);
if ($num > 0) {
return true;
} else {
return false;
}
}
如何在 MySQLi 中使用?
试试这个代码:
$sql="SELECT * FROM $table WHERE code = '$service' AND b_contents LIKE '%".$thisip."%' ";
我有一个代码可以与 MysQl 一起使用,但在 MySQLi 中不起作用:
function CheckBlocked($table, $thisip, $service) {
$sql="SELECT * FROM $table WHERE code = '$service' AND b_contents LIKE '%.$thisip.%'";
$query=mysqli_query($dbconnect,$sql);
$num=mysqli_num_rows($query);
if ($num > 0) {
return true;
} else {
return false;
}
}
如何在 MySQLi 中使用?
试试这个代码:
$sql="SELECT * FROM $table WHERE code = '$service' AND b_contents LIKE '%".$thisip."%' ";