Last active
June 23, 2024 23:26
-
-
Save Shakil-Shahadat/aa94fb3701ef52b54e2f8aedbbc994c5 to your computer and use it in GitHub Desktop.
✓ Create Database
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 | |
require_once 'db_info.inc'; | |
$db = new mysqli( $servername, $username, $password ); | |
if ( $db->connect_error ) | |
{ | |
die( 'Connection Error: ' . $db->connect_error ); | |
} | |
$result = $db->query( "CREATE DATABASE IF NOT EXISTS $database" ); | |
if ( $db->error ) | |
{ | |
die( 'Query Error: ' . $db->error ); | |
} | |
else | |
{ | |
echo 'Database creation successful.'; | |
} |
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 | |
require_once 'db_connect.inc'; | |
$result = $db->query( '' ); | |
if ( $db->error ) | |
{ | |
die( 'Query Error: ' . $db->error ); | |
} | |
else | |
{ | |
echo 'Table creation successful.'; | |
} |
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 | |
require_once 'db_info.inc'; | |
$db = new mysqli( $servername, $username, $password, $database ); | |
if ( $db->connect_error ) | |
{ | |
die( 'Connection Error: ' . $db->connect_error ); | |
} |
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 | |
$servername = 'localhost'; | |
$username = 'root'; | |
$password = ''; | |
$database = ''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment