Update: 2026-06-16 01:17:28
This commit is contained in:
@@ -12,7 +12,6 @@ $current_month = str_pad($current_month, 2, "0", STR_PAD_LEFT);
|
||||
$first_day_of_month = date('Y-m-d', strtotime($current_year . '-' . $current_month . '-01'));
|
||||
$last_day_of_month = date('Y-m-t', strtotime($first_day_of_month));
|
||||
|
||||
// تم تعديل الاستعلام ليستخدم المتغيرات $first_day_of_month و $last_day_of_month
|
||||
$sql = "SELECT
|
||||
DATE(d.created_at) AS `date`,
|
||||
d.`maritalStatus` AS NAME,
|
||||
@@ -21,23 +20,20 @@ FROM
|
||||
`driver` d
|
||||
WHERE
|
||||
d.`maritalStatus` IN ('mayar','masa', 'shahd', 'rama2','rama1')
|
||||
AND DATE(d.created_at) >= '$first_day_of_month'
|
||||
AND DATE(d.created_at) <= '$last_day_of_month'
|
||||
AND DATE(d.created_at) >= :first_day
|
||||
AND DATE(d.created_at) <= :last_day
|
||||
GROUP BY
|
||||
`date`, d.`maritalStatus`
|
||||
ORDER BY
|
||||
`date` ASC;
|
||||
";
|
||||
`date` ASC";
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->execute([':first_day' => $first_day_of_month, ':last_day' => $last_day_of_month]);
|
||||
$passenger_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($passenger_data) {
|
||||
// طباعة البيانات كـ JSON
|
||||
jsonSuccess($data = $passenger_data);
|
||||
jsonSuccess($passenger_data);
|
||||
} else {
|
||||
// طباعة رسالة فشل
|
||||
jsonError($message = "No data found");
|
||||
jsonError("No data found");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user