{$table_prefix}billing_invoices Table Structure\n"; $result = mysqli_query($db, "DESCRIBE {$table_prefix}billing_invoices"); if (!$result) { die("Table doesn't exist or query failed: " . mysqli_error($db)); } echo "\n"; echo "\n"; while ($row = mysqli_fetch_assoc($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; } echo "
FieldTypeNullKeyDefaultExtra
{$row['Field']}{$row['Type']}{$row['Null']}{$row['Key']}" . ($row['Default'] ?? 'NULL') . "{$row['Extra']}
\n"; // Count existing invoices $count_result = mysqli_query($db, "SELECT COUNT(*) as cnt FROM {$table_prefix}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 {$table_prefix}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 ""; } echo "\n"; $first = false; mysqli_data_seek($last_result, 0); } } while ($row = mysqli_fetch_assoc($last_result)) { echo ""; foreach ($row as $val) { echo ""; } echo "\n"; } echo "
{$col}
" . htmlspecialchars($val ?? 'NULL') . "
\n"; } else { echo "

No invoices found.

\n"; } mysqli_close($db); ?>