Added: Stats in dashboard
All checks were successful
Build and Deploy Zola Website / build_and_deploy (push) Successful in 12s

This commit is contained in:
2025-01-05 21:24:55 +01:00
parent 21c2f4598b
commit ccbb0eac64
6 changed files with 143 additions and 32 deletions

View File

@ -33,9 +33,9 @@ class Vehicle {
}
}
public function getVehiclesByUser($userId) {
public function getVehiclesByUser($user_id) {
$stmt = $this->db->prepare("SELECT id, name, registration_plate, fuel_type, note, created_at FROM vehicles WHERE user_id = ?");
$stmt->bind_param("i", $userId);
$stmt->bind_param("i", $user_id);
$stmt->execute();
$result = $stmt->get_result();
@ -46,4 +46,18 @@ class Vehicle {
return $vehicles;
}
public function getDefaultVehicle($user_id) {
$stmt = $this->db->prepare("
SELECT id, name, registration_plate, fuel_type, note, is_default
FROM vehicles
WHERE user_id = ? AND is_default = TRUE
LIMIT 1
");
$stmt->bind_param("i", $user_id);
$stmt->execute();
$result = $stmt->get_result();
return $result->fetch_assoc();
}
}