I was running an example from a mysqli tutorial.
$mysqli = new mysqli(\"localhost\", \"user\", \"password\", \"database\");
if($mysqli->connect_errno)
{
ech
You have to use this:
$mysqli=new mysqli("localhost","user","password") or die(".........");
if($mysqli->query("Create database if not exists MyDB")){
"Failed creating new database: ".$mysqli->connect_errno();
die();
}
$mysqli->select_db("MyDB");
$mysqli->close();
try something like this
$mysqli = new mysqli("localhost", "user", "password");
in this way you are connected to database
and put this query using mysqli
Create Database database1