$ci = implode('','', $_GET['city']);
$res = mysqli_query($link,"SELECT * FROM data WHERE (date BETWEEN '$dd1' AND '$dd2') AND (city IN('$ci')) ORDER BY id DESC")or die (mysql_error());
如果我echo $ci
而不是显示值JND','RJT','ABD
但不使用变量
如果我直接放置city IN ('JND','RJT','ABD')
它有效..
使用可靠的不执行查询
答案 0 :(得分:0)
尝试检查您的查询文字
$ci = implode("','", $_GET['city']);
$query = "SELECT * FROM data WHERE (date BETWEEN '$dd1' AND '$dd2') AND (city IN('$ci')) ORDER BY id DESC";
echo $query;
$res = mysqli_query($link,$query)or die (mysql_error());