Home >php教程 >php手册 >PHP删除MYSQL数据库中所有表的代码

PHP删除MYSQL数据库中所有表的代码

WBOY
WBOYOriginal
2016-06-13 11:40:201100browse

如果不想删除库,只想删除库里的所有表,那就用这个脚本吧呵呵

很方便的.

以下为引用的内容:
.$hostname ='localhost';
$userid = 'user';
$password = 'password';
$dbname = 'dbname';
$connect = mysql_connect($hostname,$userid,$password);
mysql_select_db($dbname);
$result = mysql_query("show table status from $dbname",$connect);
while($data=mysql_fetch_array($result)) {
mysql_query("drop table $data[Name]");
}
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn