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

<?php
// Connect to database
require_once 'admin/database/db_config.php';

echo "<h1>Payment Table Data Verification</h1>";

// Verify if payment_details column exists
echo "<h2>Checking payment_details Column</h2>";
$result = $conn->query("SHOW COLUMNS FROM payments LIKE 'payment_details'");

if ($result && $result->num_rows > 0) {
    echo "<div style='color: green; font-weight: bold; margin-bottom: 15px;'>✓ payment_details column exists in the payments table.</div>";
    $row = $result->fetch_assoc();
    echo "<pre>";
    print_r($row);
    echo "</pre>";
} else {
    echo "<div style='color: red; font-weight: bold; margin-bottom: 15px;'>✗ payment_details column does NOT exist in the payments table!</div>";
}

// Check for enrollment_id column (should not exist)
echo "<h2>Checking enrollment_id Column</h2>";
$result = $conn->query("SHOW COLUMNS FROM payments LIKE 'enrollment_id'");

if ($result && $result->num_rows > 0) {
    echo "<div style='color: red; font-weight: bold; margin-bottom: 15px;'>✗ enrollment_id column still exists in the payments table!</div>";
    $row = $result->fetch_assoc();
    echo "<pre>";
    print_r($row);
    echo "</pre>";
} else {
    echo "<div style='color: green; font-weight: bold; margin-bottom: 15px;'>✓ enrollment_id column correctly does not exist.</div>";
}

// Display table definition
echo "<h2>Table Definition</h2>";
$result = $conn->query("SHOW CREATE TABLE payments");
if ($result && $result->num_rows > 0) {
    $row = $result->fetch_assoc();
    echo "<pre style='background-color: #f4f4f4; padding: 10px; border: 1px solid #ddd; overflow: auto;'>";
    echo htmlspecialchars($row['Create Table']);
    echo "</pre>";
} else {
    echo "<div style='color: red;'>Could not retrieve table definition.</div>";
}

// Display all columns
echo "<h2>All Columns in payments Table</h2>";
$result = $conn->query("DESCRIBE payments");

if ($result) {
    echo "<table border='1' style='border-collapse: collapse; width: 100%;'>";
    echo "<tr style='background-color: #f8f9fc;'><th style='padding: 8px; border: 1px solid #ddd;'>Field</th><th style='padding: 8px; border: 1px solid #ddd;'>Type</th><th style='padding: 8px; border: 1px solid #ddd;'>Null</th><th style='padding: 8px; border: 1px solid #ddd;'>Key</th><th style='padding: 8px; border: 1px solid #ddd;'>Default</th><th style='padding: 8px; border: 1px solid #ddd;'>Extra</th></tr>";
    
    while ($row = $result->fetch_assoc()) {
        echo "<tr>";
        echo "<td style='padding: 8px; border: 1px solid #ddd;'>" . $row['Field'] . "</td>";
        echo "<td style='padding: 8px; border: 1px solid #ddd;'>" . $row['Type'] . "</td>";
        echo "<td style='padding: 8px; border: 1px solid #ddd;'>" . $row['Null'] . "</td>";
        echo "<td style='padding: 8px; border: 1px solid #ddd;'>" . $row['Key'] . "</td>";
        echo "<td style='padding: 8px; border: 1px solid #ddd;'>" . $row['Default'] . "</td>";
        echo "<td style='padding: 8px; border: 1px solid #ddd;'>" . $row['Extra'] . "</td>";
        echo "</tr>";
    }
    
    echo "</table>";
} else {
    echo "<p>Error describing payments table: " . $conn->error . "</p>";
}

// Add links to fix and retry
echo "<div style='margin-top: 20px;'>";
echo "<a href='reset_payments_table.php' class='btn btn-warning' style='background-color: #f0ad4e; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px; margin-right: 10px;'>Reset Payments Table</a>";
echo "<a href='enroll/payment.php?application_id=3' class='btn btn-primary' style='background-color: #4e73df; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;'>Try Payment Again</a>";
echo "</div>";
?>