Name

mysql_drop_db

Synopsis

boolean mysql_drop_db(string database [, cresource connection])

Drops a database. An optional connection can be supplied; otherwise, the most recently opened connection resource handle that is still open is used. This function permanently deletes the database, its tables, and its data.

The function returns true on success and false on failure.

Example

<?php
  $connection = mysql_connect("localhost", "fred", "shhh");
  
  if (mysql_drop_db("temp", $connection)) 
     echo "Dropped database 'temp'";
  else
     echo "Drop database 'temp' failed!";
?>

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.