<?php
require_once 'config/database.php';

try {
    $stmt = $pdo->query('SELECT COUNT(*) as count FROM timetable');
    $count = $stmt->fetch();
    echo 'Total timetable records: ' . $count['count'] . PHP_EOL;

    $stmt = $pdo->query('SELECT * FROM timetable LIMIT 5');
    $results = $stmt->fetchAll();
    echo 'Sample records:' . PHP_EOL;
    foreach ($results as $row) {
        echo 'ID: ' . $row['id'] . ', Class: ' . $row['class_id'] . ', Subject: ' . $row['subject_id'] . 
             ', Teacher: ' . $row['teacher_id'] . ', Day: ' . $row['day_of_week'] . 
             ', Time: ' . $row['start_time'] . ' - ' . $row['end_time'] . PHP_EOL;
    }
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . PHP_EOL;
}
?>