how can i create database in sql inside php file

  database, mysql, php

I already create a database in MySQL using

"CREATE DATABASE register"

and i set

$db= "CREATE DATABASE register";

$host="localhost";
$dbusername="root";
$dbpassword="";
$dbname= "register";


//create database connection 
    $conn = new mysqli($host,$dbusername,$dbpassword,$dbname);
    

but some error that. becomes error Warning: mysqli::__construct(): (HY000/1049): Unknown database ‘register’ in C:xampphtdocswebhtmlreg.php on line 19

how can i fix that

Source: Ask PHP

LEAVE A COMMENT