Pages

Monday, 1 May 2017

MySQLi Database creation

<?php
$host='localhost';
$user='root';
$pass='';
$conn=mysqli_connect($host,$uAser,$pass);
if(!$conn)
{
    die('Could not connect : '.mysqli_connect_error());
}
echo "Connect successfully</br>";

$sql = 'CREATE  DATABASE mydb';
if(mysqli_query($conn,$sql))
{
    echo "Database mydb created successfull";
}else{
    echo "Sorry, database creation failed ".mysqli_error($conn);
}
mysqli_close($conn);
?>

No comments:

Post a Comment

Code Review

 SOLID Principles S – Single Responsibility Principle There should never be more than one reason for a class to change. O – Open-Closed Prin...