I am using XAMPP on windows.
$dropDB=$dbc-> query("DROP DATABASE $myDB1");
I like to use the code above.
if there is the database “myDB1”, it drop the database.
so far so good.
however, if there is not the database “myDB1”. it produces fatal error saying like the following.
I don’t know whether $myDB1 does exist or doen’t exist.
I want if there is $myDB1, then drop it.
My wanna-be-code would look like the following.
if ( database $myDB1 exist ) {
$dropDB=$dbc-> query("DROP DATABASE $myDB");
}
How can I check whether a database does eist or doesn’t exist?