Last active
December 18, 2021 01:46
-
-
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 = ''; |
Author
Shakil-Shahadat
commented
Dec 18, 2021
- Move this to miscellaneous.php.
- Improve readability by adding curly brackets.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment