我尝试将AND
和OR
语法与SELECT
组合使用,但不会显示数据。
$cel
可以是数字或空,$ruta
和$jornada
可以分配
$query = mysqli_query($con,
"SELECT
*
FROM
registros_tty651
WHERE
(cel = '$cel' OR cel = '')
AND ruta = '$ruta'
AND jornada = '$jornada'
ORDER BY fecha_r DESC;");
答案 0 :(得分:1)
尝试
$query = mysqli_query($con,
"SELECT
*
FROM
registros_tty651
WHERE
(cel = '$cel' OR cel IS NULL)
AND (ruta = '$ruta'
AND jornada = '$jornada')
ORDER BY fecha_r DESC;");