我试图将存储为变量的日期与mysql中的行进行比较,这是我到目前为止所处的位置:
if(isset($_REQUEST['date1'])) {
$datum = $_REQUEST['date1'];
if($datum == "0000-00-00") {$datum = "";}
echo "Date: $datum";
echo "<br>";
} else { $datum = ""; }
$result = mysqli_query($link, " SELECT id, auditor, auditee, datum, department, func, proc, audit_type, copy_to, comments
FROM audit_data
WHERE
(
`auditor` LIKE '%$search_field%' OR
`auditee` LIKE '%$search_field%' OR
`department` LIKE '%$search_field%' OR
`func` LIKE '%$search_field%' OR
`proc` LIKE '%$search_field%' OR
`audit_type` LIKE '%$search_field%')
OR
(`id` = '$radio_id')
OR
(`datum` LIKE '%$datum%')
" )
OR
die(mysqli_error($link));
我无法让查询返回包含请求日期的行。
$ datum存储为YYYY-MM-DD
datum
是一样的。
我已经尝试了一切!我到底做错了什么?