我现在有了 :
$inhoud = $_POST['inhoud'];
if($inhoud == "") {
echo $inhoud;
$inhoud = NULL;
echo $inhoud;
}
$sql = 'SELECT DISTINCT bestanden.id AS id,
bestanden.uploader AS uploader,
bestanden.name AS name,
bestanden.mime AS mime,
bestanden.size AS size,
bestanden.created AS created,
zoeken.open_id AS open_id,
zoeken.woord AS woord
FROM bestanden
LEFT JOIN zoeken ON bestanden.id = zoeken.open_id
WHERE zoeken.woord = "' . $inhoud . '" AND
bestanden.name LIKE "%' . $_POST['naam'] . '%" AND
bestanden.mime LIKE "%' . $_POST['formaat'] . '%"
AND bestanden.created LIKE "%' . $_POST['datum'] . '%";';
$result = mysql_query($sql);
但是当我搜索并且 $inhoud 为空时,我没有得到任何结果,因为它们那里没有空的(“”)(inhoud)空间。是否可以在我的 mysql_query 中使用 if 或其他内容?