mysql_drop_db
(PHP 4, PHP 5, PECL mysql:1.0)
mysql_drop_db — Drop (delete) a MySQL database
Descrierea
mysql_drop_db() attempts to drop (remove) an entire database from the server associated with the specified link identifier. This function is deprecated, it is preferable to use mysql_query() to issue a sql DROP DATABASE statement instead.
Parametri
- database_name
-
The name of the database that will be deleted.
- link_identifier
-
Conexiunea MySQL. Dacă identificatorul legăturii nu este specificat, se presupune că este ultima legătură deschisă cu ajutorul mysql_connect(). Dacă nu este găsită nici o astfel de legătură, se va încerca crearea uneia prin apelul mysql_connect() fără argumente. În caz că nici o conexiune nu este găsită sau stabilită, se va genera o avertizare de nivelul E_WARNING.
Valorile întroarse
Întoarce valoarea TRUE în cazul succesului sau FALSE în cazul eşecului.
Exemple
Example#1 mysql_drop_db() alternative example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$sql = 'DROP DATABASE my_db';
if (mysql_query($sql, $link)) {
echo "Database my_db was successfully dropped\n";
} else {
echo 'Error dropping database: ' . mysql_error() . "\n";
}
?>
Note
This function will not be available if the MySQL extension was built against a MySQL 4.x client library.
Notă: Pentru compatibilitatea cu versiunile anterioare, următorul pseudonim dezaprobat poate fi utilizat: mysql_dropdb()