query(" SELECT * FROM services WHERE status='active' ORDER BY id DESC LIMIT 8 ")->fetchAll(PDO::FETCH_ASSOC); } catch(Exception $e) { $services = []; } // Get slider images from database try { $sliders = $db->query(" SELECT * FROM slider_images WHERE status='active' ORDER BY order_position ASC, id DESC ")->fetchAll(PDO::FETCH_ASSOC); } catch(Exception $e) { $sliders = []; } // Get testimonials from database with error handling try { $testimonials = $db->query(" SELECT t.*, u.name as user_name, u.image as user_image FROM testimonials t JOIN users u ON t.user_id = u.id WHERE t.status='active' ORDER BY t.id DESC LIMIT 3 ")->fetchAll(PDO::FETCH_ASSOC); // If no testimonials, use default if(empty($testimonials)) { throw new Exception('No testimonials found'); } } catch(Exception $e) { // Default testimonials $testimonials = [ [ 'id' => 1, 'user_name' => 'Rahul Sharma', 'user_image' => 'https://randomuser.me/api/portraits/men/1.jpg', 'rating' => 5, 'comment' => 'Excellent service! The electrician was very professional and fixed my AC quickly. Highly recommended!', 'service_name' => 'AC Repair' ], [ 'id' => 2, 'user_name' => 'Priya Patel', 'user_image' => 'https://randomuser.me/api/portraits/women/2.jpg', 'rating' => 5, 'comment' => 'Very satisfied with the service. They came on time and did a great job with my fridge repair.', 'service_name' => 'Fridge Repair' ], [ 'id' => 3, 'user_name' => 'Amit Kumar', 'user_image' => 'https://randomuser.me/api/portraits/men/3.jpg', 'rating' => 4, 'comment' => 'Good workmanship and reasonable prices. Will definitely use their services again.', 'service_name' => 'Wiring' ] ]; } $totalServices = count($services); ?>
Expert in electrical services
Satisfied clients
Emergency support available
Quality work guaranteed
Professional electrical services for your home and office
Please check back later. Services will be added soon.
Available round the clock for all emergencies
Experienced and certified professionals
Transparent pricing, no hidden costs
""