PHP,MySQL:在休假时显示用户'

时间:2015-12-01 04:03:55

标签: php mysql

我在下面的代码中有关于如何显示当前的人员#34;休假时间#34;今天。

$today = date("j F, Y");//date format is->1 December, 2015
$result = $db->query("SELECT name, date_apply, leave_from, leave_end, num_days, reason FROM applied_user  WHERE status = 'Approved' AND leave_from = '$today'");

我的问题是,是否可以在当天之前显示所有批准的假期?谢谢..

1 个答案:

答案 0 :(得分:0)

试试这个

$today = date('d F, Y'); //current date (11 December, 2015)
$result = $db->query(
    "SELECT name, date_apply, leave_from, leave_end, num_days, reason 
    FROM applied_user  
    WHERE status = 'Approved' 
    AND leave_from >= '$today'");

Phpfiddle Preview