note 11046 deleted from function.mysql-drop-db by didou

From: Date: Sat, 17 May 2003 19:53:57 +0000
Subject: note 11046 deleted from function.mysql-drop-db by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-48228@lists.php.net to get a copy of this message
Note Submitter: misterfrench@hotmail.com If you ask mysql_drop_db to drop a database that does not exist, it simply returns an error. It is a good idea to check that the db you are trying to drop exists first. $dblist = mysql_list_dbs($dbidentifier) $i=0 while( $name = mysql_dbname($dblist, $i) ) { if( $name == "mydb" ) { $foundit = true; mysql_drop_db("mydb",$dbidentifier) } $i++; } if( $foundit ) echo "DB dropped" else echo "DB mydb not found"

« previous php.notes (#48228) next »