-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_db.php
More file actions
30 lines (23 loc) · 773 Bytes
/
check_db.php
File metadata and controls
30 lines (23 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'connection.php';
echo "<pre>";
// Check if the expenses table exists
$table_check = $con->query("SHOW TABLES LIKE 'expenses'");
echo "Expenses table exists: " . ($table_check->num_rows > 0 ? "Yes" : "No") . "\n";
if ($table_check->num_rows > 0) {
// Show table structure
$structure = $con->query("DESCRIBE expenses");
echo "\nTable structure:\n";
while ($row = $structure->fetch_assoc()) {
echo print_r($row, true) . "\n";
}
// Show any existing records
$records = $con->query("SELECT COUNT(*) as count FROM expenses");
$count = $records->fetch_assoc()['count'];
echo "\nNumber of records: " . $count . "\n";
}
echo "</pre>";
$con->close();
?>