Fratyr
Feb 18th 2008, 12:16 am
I want to check if the database already exist before creating it, if yes -> say it exist, if no -> create a new one, if error occured -> echo it.
This is what i got for now, what should i add to complete the statement?
if (mysql_query("CREATE DATABASE ".$dbname,$dbcnx));
{
echo "Database created: " . $dbname;
}
else
{
echo "Error creating database: " . die (mysql_error($dbcnx));
}
?>
This is what i got for now, what should i add to complete the statement?
if (mysql_query("CREATE DATABASE ".$dbname,$dbcnx));
{
echo "Database created: " . $dbname;
}
else
{
echo "Error creating database: " . die (mysql_error($dbcnx));
}
?>