Path : /home/vishqocm/pcib.in/
File Upload :
Current File : //home/vishqocm/pcib.in/describe_enrollments.php

<?php
// Enable error reporting for debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Include database configuration
require_once 'admin/database/db_config.php';

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Get table structure
$result = $conn->query("DESCRIBE enrollments");

// Display table structure
echo "=== Enrollments Table Structure ===\n\n";

if ($result) {
    printf("%-25s | %-30s | %-6s | %-6s | %-20s | %-20s\n", 
        "Field", "Type", "Null", "Key", "Default", "Extra");
    echo str_repeat("-", 120) . "\n";
    
    while ($row = $result->fetch_assoc()) {
        $default = $row['Default'] === NULL ? "NULL" : $row['Default'];
        printf("%-25s | %-30s | %-6s | %-6s | %-20s | %-20s\n", 
            $row['Field'], 
            $row['Type'], 
            $row['Null'], 
            $row['Key'], 
            $default, 
            $row['Extra']
        );
    }
} else {
    echo "Error: " . $conn->error . "\n";
}

echo "\n";

// Check if the certificate columns exist
$checkColumns = [
    'certificate_number',
    'certificate_path',
    'certificate_issue_date',
    'verification_code'
];

echo "=== Certificate Column Check ===\n\n";

foreach ($checkColumns as $column) {
    $checkQuery = "SHOW COLUMNS FROM enrollments LIKE '$column'";
    $checkResult = $conn->query($checkQuery);
    
    if ($checkResult && $checkResult->num_rows > 0) {
        $columnInfo = $checkResult->fetch_assoc();
        echo "[✓] Column '$column' exists\n";
        echo "    Type: " . $columnInfo['Type'] . "\n";
        echo "    Null: " . $columnInfo['Null'] . "\n";
        echo "    Default: " . ($columnInfo['Default'] === NULL ? "NULL" : $columnInfo['Default']) . "\n\n";
    } else {
        echo "[✗] Column '$column' does NOT exist\n\n";
    }
}
?>