Created
October 9, 2013 08:21
-
-
Save nhandl3/6897986 to your computer and use it in GitHub Desktop.
This file contains 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 | |
define('DB_NAME' , 'dbname' ); | |
define('DB_USER' , 'user' ); | |
define('DB_PASSWORD', 'pwd' ); | |
define('DB_HOST' , 'localhost'); | |
$con=mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD); | |
// Check connection | |
if (mysqli_connect_errno()) | |
{ | |
echo "Failed to connect to MySQL: " . mysqli_connect_error(); | |
} | |
// Create database | |
$sql="CREATE DATABASE ".DB_NAME; | |
if (mysqli_query($con,$sql)) | |
{ | |
echo "Database my_db created successfully"; | |
} | |
else | |
{ | |
echo "Error creating database: " . mysqli_error($con); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment