我正在使用:
$ordem = "%".$_GET['ordem']."%"; $arr = []; $stmt = $conn->prepare("SELECT texto,data_hora FROM logs WHERE texto LIKE ?"); $stmt->bind_param('s',$ordem); $stmt->execute();
这个 $ordem 变量正在接收包含在db中的值,但找不到。。。怎么了?谢谢
$ordem
ohtdti5x1#
尝试以下代码
$stmt = $conn->prepare("SELECT texto, data_hora FROM logs WHERE texto LIKE '%?%'"); $stmt->bind_param('s', $_GET['ordem']);
或者试试下面和你做的相似的地方
$param = "%{$_GET['ordem']}%"; $stmt = $db->prepare("SELECT texto, data_hora FROM logs WHERE texto LIKE ?"); $stmt->bind_param("s", $param);
1条答案
按热度按时间ohtdti5x1#
尝试以下代码
或者试试下面和你做的相似的地方