Create the database

To create the database, we need to use mysql_query function and CREATE DATABASE statetment

$conn = mysql_connect("localhost","root","root");
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}

if (mysql_query("CREATE DATABASE my_db",$conn))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}

?>

0 comments:

Post a Comment