I copied this code from w3schools and tried running it. I get a display till "Create connection."
Then neither the error message nor success message.
I have ensured following commands for error reporting as well, but I am still getting a blank page:
<?php
ini_set('display_errors', 'On');
ini_set('html_errors', 0);
error_reporting(-1);
$servername = "localhost";
$username = "root";
$password = "root@123";
echo "Create connection";
$conn = new mysqli($servername, $username, $password);
echo "Check connection";
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Create database
$sql = "CREATE DATABASE myDB";
if ($conn->query($sql) === TRUE) {
echo "Database created successfully";
} else {
echo "Error creating database: " . $conn->error;
}
echo "closing";
$conn->close();
?>
Can anyone tell me what the issue is?