include 'config.php';$location_null = "";$location = "%{test}%";$stmt = $conn->prepare('SELECT * FROM students WHERE location LIKE ? AND location = ?');$stmt->bind_param('ss', $location, $location_null); $stmt->execute();这是我的mysql代码。我想从数据库中获取数据以获取诸如会话和相等变量之类的位置,但这种方式不起作用。
1 回答
慕尼黑的夜晚无繁华
TA贡献1864条经验 获得超6个赞
您必须在查询AND
中用 an替换,OR
以使这两个条件都有效:
$stmt = $conn->prepare('SELECT * FROM students WHERE location LIKE ? OR location = ?');
- 1 回答
- 0 关注
- 91 浏览
添加回答
举报
0/150
提交
取消