Sindbad~EG File Manager
<?php
require_once 'config/config.php';
$db = Database::getInstance()->getConnection();
echo "<h2>Checking memberuser_codes table...</h2>";
try {
// Check if table exists
$stmt = $db->query("SHOW TABLES LIKE 'memberuser_codes'");
$tableExists = $stmt->fetch() !== false;
if ($tableExists) {
echo "<p style='color: green;'><strong>✓ Table 'memberuser_codes' EXISTS</strong></p>";
// Show table structure
echo "<h3>Table Structure:</h3>";
$stmt = $db->query("DESCRIBE memberuser_codes");
$columns = $stmt->fetchAll();
echo "<table border='1' style='border-collapse: collapse; margin: 10px 0;'>";
echo "<tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th><th>Extra</th></tr>";
foreach ($columns as $column) {
echo "<tr>";
echo "<td>" . htmlspecialchars($column['Field']) . "</td>";
echo "<td>" . htmlspecialchars($column['Type']) . "</td>";
echo "<td>" . htmlspecialchars($column['Null']) . "</td>";
echo "<td>" . htmlspecialchars($column['Key']) . "</td>";
echo "<td>" . htmlspecialchars($column['Default'] ?? 'NULL') . "</td>";
echo "<td>" . htmlspecialchars($column['Extra']) . "</td>";
echo "</tr>";
}
echo "</table>";
// Show record count
$stmt = $db->query("SELECT COUNT(*) as count FROM memberuser_codes");
$count = $stmt->fetch()['count'];
echo "<p><strong>Records in table:</strong> " . $count . "</p>";
// Show sample records if any exist
if ($count > 0) {
echo "<h3>Sample Records:</h3>";
$stmt = $db->query("SELECT id, code, tracking_code, code_type, member_id, user_id, is_active, created_at FROM memberuser_codes LIMIT 5");
$records = $stmt->fetchAll();
echo "<table border='1' style='border-collapse: collapse; margin: 10px 0;'>";
echo "<tr><th>ID</th><th>Code</th><th>Tracking Code</th><th>Type</th><th>Member ID</th><th>User ID</th><th>Active</th><th>Created</th></tr>";
foreach ($records as $record) {
echo "<tr>";
echo "<td>" . htmlspecialchars($record['id']) . "</td>";
echo "<td>" . htmlspecialchars($record['code']) . "</td>";
echo "<td>" . htmlspecialchars($record['tracking_code']) . "</td>";
echo "<td>" . htmlspecialchars($record['code_type']) . "</td>";
echo "<td>" . htmlspecialchars($record['member_id'] ?? 'NULL') . "</td>";
echo "<td>" . htmlspecialchars($record['user_id'] ?? 'NULL') . "</td>";
echo "<td>" . ($record['is_active'] ? 'Yes' : 'No') . "</td>";
echo "<td>" . htmlspecialchars($record['created_at']) . "</td>";
echo "</tr>";
}
echo "</table>";
}
} else {
echo "<p style='color: red;'><strong>✗ Table 'memberuser_codes' DOES NOT EXIST</strong></p>";
echo "<p>The member codes page won't work without this table.</p>";
}
} catch (Exception $e) {
echo "<p style='color: red;'><strong>Error:</strong> " . htmlspecialchars($e->getMessage()) . "</p>";
}
echo "<hr>";
echo "<p><a href='modules/membership/codes.php'>→ Go to Member Codes Page</a></p>";
echo "<p><a href='dashboard.php'>← Back to Dashboard</a></p>";
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists