Example of MySQLi Procedural - CodeTextPro | Web Tutorial | Technology

CodeTextPro.com Provides - Web design, Technology gyan, Digital marketing, Online earnings, Seo, Adsense, Technology news, Motivation and inspiration, Latest Technology Affairs, Gadgets, Blogging

Monday, December 10, 2018

Example of MySQLi Procedural

Example (MySQLi Procedural):

 <?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = mysqli_connect($servername, $username, $password);
// Check connection
if (!$conn) {   
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
// Create database
$sql = "CREATE DATABASE myDB";
if (mysqli_query($conn, $sql)) {   
echo "Database created successfully";
}
else
{   
echo "Error creating database: " . mysqli_error($conn);
}
mysqli_close($conn);
?>

No comments:

Post a Comment