Path : /home/vishqocm/pcib.in/
File Upload :
Current File : /home/vishqocm//pcib.in/add_attempts_allowed.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);
}

echo "<h2>Adding missing attempts_allowed column to exam_schedules table</h2>";

// Add attempts_allowed column
$addAttemptsAllowed = "ALTER TABLE exam_schedules 
                       ADD COLUMN attempts_allowed INT NOT NULL DEFAULT 1 AFTER passing_percentage";

if ($conn->query($addAttemptsAllowed) === TRUE) {
    echo "<p>Successfully added attempts_allowed column.</p>";
} else {
    echo "<p>Error adding attempts_allowed column: " . $conn->error . "</p>";
}

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

echo "<p><a href='student/previous-exams.php'>Go to Previous Exams</a></p>";
?>