<?php
// Test simple pour vérifier policy_type
$servername = "localhost";
$username = "root"; // ou votre nom d'utilisateur MySQL
$password = ""; // ou votre mot de passe MySQL  
$dbname = "insurance_db"; // remplacez par le nom de votre base de données

try {
    $conn = new mysqli($servername, $username, $password, $dbname);
    
    if ($conn->connect_error) {
        die("Connexion échouée: " . $conn->connect_error);
    }
    
    echo "=== Structure de policy_table ===\n";
    $result = $conn->query("DESCRIBE policy_table");
    while($row = $result->fetch_assoc()) {
        if($row['Field'] == 'policy_type') {
            echo "Colonne: " . $row['Field'] . "\n";
            echo "Type: " . $row['Type'] . "\n";
            echo "Null: " . $row['Null'] . "\n";
            echo "Default: " . $row['Default'] . "\n\n";
        }
    }
    
    echo "=== Contenu de la table policy_type ===\n";
    $result = $conn->query("SELECT * FROM policy_type LIMIT 5");
    if($result && $result->num_rows > 0) {
        while($row = $result->fetch_assoc()) {
            echo "Type: " . $row['type'] . ", Risque: " . $row['risque'] . "\n";
        }
    } else {
        echo "Aucune donnée dans policy_type ou table n'existe pas\n";
    }
    
    echo "\n=== Derniers enregistrements de policy_table ===\n";
    $result = $conn->query("SELECT id, n_policy, policy_type FROM policy_table ORDER BY id DESC LIMIT 3");
    while($row = $result->fetch_assoc()) {
        echo "ID: " . $row['id'] . ", Policy: " . $row['n_policy'] . ", Type: '" . $row['policy_type'] . "'\n";
    }
    
} catch(Exception $e) {
    echo "Erreur: " . $e->getMessage() . "\n";
}
?>