Created
April 29, 2023 18:45
-
-
Save dorp007/7db6e8dad170e66f97dd078e02d97252 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$servername = "localhost"; | |
$username = "yourusername"; | |
$password = "yourpassword"; | |
// Create connection | |
$conn = new mysqli($servername, $username, $password); | |
// 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; | |
} | |
$conn->close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment