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

<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "popularcomputer";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

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

header("Content-Type: text/plain");

echo "Structure of exam_schedules table\n\n";

// Get the table columns
$columnsQuery = $conn->query("SHOW COLUMNS FROM exam_schedules");

$hasDurationColumn = false;
$hasAttemptsAllowedColumn = false;
$hasAllowLateAttemptsColumn = false;

while($column = $columnsQuery->fetch_assoc()) {
    echo "Field: " . $column['Field'] . "\n";
    echo "Type: " . $column['Type'] . "\n";
    echo "Null: " . $column['Null'] . "\n";
    echo "Key: " . $column['Key'] . "\n";
    echo "Default: " . $column['Default'] . "\n";
    echo "Extra: " . $column['Extra'] . "\n";
    echo "----------------------------\n";
    
    if ($column['Field'] == 'duration') {
        $hasDurationColumn = true;
    }
    
    if ($column['Field'] == 'attempts_allowed') {
        $hasAttemptsAllowedColumn = true;
    }
    
    if ($column['Field'] == 'allow_late_attempts') {
        $hasAllowLateAttemptsColumn = true;
    }
}

echo "\nColumn check results:\n";
echo "duration column exists: " . ($hasDurationColumn ? "YES" : "NO") . "\n";
echo "attempts_allowed column exists: " . ($hasAttemptsAllowedColumn ? "YES" : "NO") . "\n";
echo "allow_late_attempts column exists: " . ($hasAllowLateAttemptsColumn ? "YES" : "NO") . "\n";

// Close connection
$conn->close();
?>