我需要匹配2个代码的结果格式:
我需要得到这个的输出/格式:
$event_day = $year.'-'.$month.'-'.$list_day; // $event_day
匹配这个:
DATE_FORMAT(date,'%Y-%m-%d')
完整代码:
$query = "
SELECT title, DATE_FORMAT(date,'%Y-%m-%d') AS date
FROM table
WHERE user_id = '$session_user_id'
AND date BETWEEN '$year-$month-1' AND '" . date("Y-m-t", strtotime("$year-$month-1")) . "'
AND active = 1";
我的问题是 $event_day 仅显示以下事件:10 月、11 月和 12 月。
我在下面的代码中遇到了类似的问题:
$query = "
SELECT title, DATE_FORMAT(date,'%Y-%m-%d') AS date
FROM table
WHERE user_id = '$session_user_id'
AND date LIKE '$year-$month%'
AND active = 1";
并使用以下代码修复了它:
$query = "
SELECT title, DATE_FORMAT(date,'%Y-%m-%d') AS date
FROM table
WHERE user_id = '$session_user_id'
AND date BETWEEN '$year-$month-1' AND '" . date("Y-m-t", strtotime("$year-$month-1")) . "'
AND active = 1";
有谁知道我该如何解决这个问题?