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(); }