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

echo "Checking student with DB ID 6192...\n";

$stmt = $pdo->prepare("SELECT s.id as student_id, s.student_id as student_code, s.user_id, u.username FROM students s JOIN users u ON s.user_id = u.id WHERE s.id = ?");
$stmt->execute([6192]);
$student = $stmt->fetch();

if ($student) {
    print_r($student);
    echo "Student found with user_id: " . $student['user_id'] . "\n";
} else {
    echo "Student with DB ID 6192 not found\n";
    
    // Let's check if there's a student with that student_code
    $stmt = $pdo->prepare("SELECT s.id as student_id, s.student_id as student_code, s.user_id, u.username FROM students s JOIN users u ON s.user_id = u.id WHERE s.student_id = ?");
    $stmt->execute(['STU20250008']);
    $student = $stmt->fetch();
    
    if ($student) {
        echo "Found student with student_code STU20250008:\n";
        print_r($student);
    } else {
        echo "No student with student_code STU20250008 found either\n";
    }
}
?>