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

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

WBOY
Release: 2016-06-13 11:40:20
Original
1107 people have browsed it

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

很方便的.

以下为引用的内容:
.$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]");
}
?>

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template