ogp_billing_invoices Table Structure\n";
$result = mysqli_query($db, "DESCRIBE ogp_billing_invoices");
if (!$result) {
die("Table doesn't exist or query failed: " . mysqli_error($db));
}
echo "
\n";
echo "| Field | Type | Null | Key | Default | Extra |
\n";
while ($row = mysqli_fetch_assoc($result)) {
echo "";
echo "| {$row['Field']} | ";
echo "{$row['Type']} | ";
echo "{$row['Null']} | ";
echo "{$row['Key']} | ";
echo "" . ($row['Default'] ?? 'NULL') . " | ";
echo "{$row['Extra']} | ";
echo "
\n";
}
echo "
\n";
// Count existing invoices
$count_result = mysqli_query($db, "SELECT COUNT(*) as cnt FROM ogp_billing_invoices");
$count = mysqli_fetch_assoc($count_result);
echo "Total invoices in table: {$count['cnt']}
\n";
// Show last 5 invoices
echo "Last 5 Invoices
\n";
$last_result = mysqli_query($db, "SELECT * FROM ogp_billing_invoices ORDER BY invoice_id DESC LIMIT 5");
if (mysqli_num_rows($last_result) > 0) {
echo "\n";
echo "";
$first = true;
while ($row = mysqli_fetch_assoc($last_result)) {
if ($first) {
foreach (array_keys($row) as $col) {
echo "| {$col} | ";
}
echo "
\n";
$first = false;
mysqli_data_seek($last_result, 0);
}
}
while ($row = mysqli_fetch_assoc($last_result)) {
echo "";
foreach ($row as $val) {
echo "| " . htmlspecialchars($val ?? 'NULL') . " | ";
}
echo "
\n";
}
echo "
\n";
} else {
echo "No invoices found.
\n";
}
mysqli_close($db);
?>