I'm trying to create a database with CREATE DATABASE command, but instead it gives me an error. this is my code:
$db_usr = mysql_real_escape_string($_POST["email"]);
$con=mysql_connect("localhost","root");
if (! $con)
{
die('Could not connect: ' . mysql_error());
}
else
{
test();
}
function test()
{
$sql = "CREATE DATABASE '$db_usr'";
mysql_query($sql);
}
It always returns "Undefined variable"