Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php echo "this is a PHP program \n"; // Using predefined $mysqli connection variable if ($mysqli) { echo "Successful connection!"; } else { echo "Failed to connect!"; } $query = "SHOW DATABASES"; $result = mysqli_query($mysqli, $query); if ($result) { echo "\nits correct dude\n"; // Fetch and display results using mysqli_fetch_assoc() while ($row = mysqli_fetch_assoc($result)) { echo "Database: " . $row['Database'] . "\n"; } } ?>
Copy Clear