我需要查询方面的帮助。仅在postal_date行中列出3条狗展。但是,我不希望任何超过当前日期的结果。
我列出了它们,但有些确实显示在当前日期之后。
<?php
$query = "SELECT shows.*, judges.* FROM `shows`
INNER JOIN `judges` ON shows.judge_id = judges.judge_id
ORDER BY shows.postal_close DESC
LIMIT 3";
$select_all_shows_query = mysqli_query($connection,$query);
while($row = mysqli_fetch_assoc($select_all_shows_query)) {
$show_id = $row['show_id'];
$show_title = $row['show_title'];
$postal_close = date('d F Y', strtotime($row['postal_close']));
$show_image = $row['show_image'];
$judge_name2 = $row['judge_name2'];
$judge_id = $row['judge_id'];
?>
答案 0 :(得分:2)
$query = "SELECT shows.*, judges.* FROM `shows`
INNER JOIN `judges` ON shows.judge_id = judges.judge_id
WHERE DATE(shows.postal_close) >= CURDATE()
ORDER BY shows.postal_close DESC LIMIT 3";