26 lines
619 B
PHP
26 lines
619 B
PHP
<?php
|
|
require_once __DIR__ . '/includes/config.php';
|
|
|
|
try {
|
|
$conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
|
|
|
|
if ($conn->connect_error) {
|
|
throw new Exception("Connection failed: " . $conn->connect_error);
|
|
}
|
|
|
|
echo "Database connection successful!\n";
|
|
|
|
// Test query
|
|
$result = $conn->query("SHOW TABLES");
|
|
if ($result) {
|
|
echo "\nTables in database:\n";
|
|
while ($row = $result->fetch_array()) {
|
|
echo "- " . $row[0] . "\n";
|
|
}
|
|
}
|
|
|
|
$conn->close();
|
|
} catch (Exception $e) {
|
|
echo "Error: " . $e->getMessage();
|
|
}
|