DROP DATABASE Function
Syntax
DROP DATABASE dbname;
Example: 1
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$con = mysql_connect("$hostname", "$username", "$password");
if(!$con)
{
die("Could not connect: " . mysql_error());
}
echo "Connected successfully<br />";
$sql = "DROP DATABASE Aspell";
$retval = mysql_query( $sql, $con);
if(!$retval )
{
die("Could not delete database: " . mysql_error());
}
echo "Database Aspell deleted successfully\n";
mysql_close($con);
?>
$hostname = "localhost";
$username = "root";
$password = "";
$con = mysql_connect("$hostname", "$username", "$password");
if(!$con)
{
die("Could not connect: " . mysql_error());
}
echo "Connected successfully<br />";
$sql = "DROP DATABASE Aspell";
$retval = mysql_query( $sql, $con);
if(!$retval )
{
die("Could not delete database: " . mysql_error());
}
echo "Database Aspell deleted successfully\n";
mysql_close($con);
?>
Output
Connected successfullyDatabase Aspell deleted successfully
No comments:
Post a Comment