anantamu.com
PHP - Introduction
PHP - Setup
PHP - Syntax
PHP - String
PHP - constants
PHP - Operators
PHP - Superglobals
PHP Forms PHP - Forms
MySQL
MySQL - Create DB
MySQL - Update Data
MySQL - Delete Data


MySql Database connect using PHP


CREATE DATABASE DATABASENAME

MySQL is a database system , it is used to connect MySQl server.

MySQL It is free software to download and use it.



CREATE DATABASE

<?php
$servername = "localhost";
$username = "root";
$password = "";
//server connection
$connection = mysqli_connect($servername, $username, $password);
if (!$connection) {
die("Connection failed: " . mysqli_connect_error());
}

$sqlQuery = "CREATE DATABASE sample";
if (mysqli_query($connection, $sqlQuery)) {
    echo "Database  is created successfully!";
} else {
    echo "Error creating database: " . mysqli_error($connection);
}

// closing connection
mysqli_close($connection);
?>
                    

Create database using Mysql functions.


School