query('SELECT COUNT(*) FROM contacts'); $count = $stmt->fetchColumn(); // If no contacts, add some sample data if ($count == 0) { db()->exec(""" INSERT INTO contacts (name, email) VALUES ('John Doe', 'john.doe@example.com'), ('Jane Smith', 'jane.smith@example.com'), ('Peter Jones', 'peter.jones@example.com'); """); } // Fetch all contacts $stmt = db()->query('SELECT * FROM contacts ORDER BY created_at DESC'); $contacts = $stmt->fetchAll(); ?>