prepare("INSERT INTO service_ratings (rating, comment) VALUES (?, ?)"); $stmt->execute([$rating, $comment]); $success = true; } else if ($userId) { $stmt = $pdo->prepare("INSERT INTO staff_ratings (user_id, rating, comment) VALUES (?, ?, ?)"); $stmt->execute([$userId, $rating, $comment]); $success = true; } else { $error = "Please select a staff member."; } } catch (Exception $e) { $error = "Error saving rating: " . $e->getMessage(); } } else { $error = "Please provide a rating."; } } // Fetch active and ratable users with pictures $pdo = db(); $stmt = $pdo->query("SELECT id, full_name, full_name_ar, username, profile_pic FROM users WHERE is_active = 1 AND is_ratable = 1 ORDER BY full_name ASC"); $users = $stmt->fetchAll(PDO::FETCH_ASSOC); ?>