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

try {
    $stmt = $pdo->query('SELECT id, name FROM subjects WHERE name LIKE "%Bangla%" OR name LIKE "%বাংলা%" OR name LIKE "%Bangladesh%" ORDER BY name');
    $subjects = $stmt->fetchAll(PDO::FETCH_ASSOC);
    echo "Subjects containing Bangla/Bangladesh:\n";
    foreach ($subjects as $subject) {
        echo "- ID: {$subject['id']}, Name: {$subject['name']}\n";
    }

    echo "\nAll subjects starting with Bangla/বাংলা:\n";
    $stmt = $pdo->query('SELECT id, name FROM subjects WHERE name LIKE "Bangla%" OR name LIKE "বাংলা%" ORDER BY name');
    $bangla_subjects = $stmt->fetchAll(PDO::FETCH_ASSOC);
    foreach ($bangla_subjects as $subject) {
        echo "- ID: {$subject['id']}, Name: {$subject['name']}\n";
    }

    echo "\nAll subjects starting with English/ইংরেজি:\n";
    $stmt = $pdo->query('SELECT id, name FROM subjects WHERE name LIKE "English%" OR name LIKE "ইংরেজি%" ORDER BY name');
    $english_subjects = $stmt->fetchAll(PDO::FETCH_ASSOC);
    foreach ($english_subjects as $subject) {
        echo "- ID: {$subject['id']}, Name: {$subject['name']}\n";
    }

} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
?>