<?php |
02 |
|
03 |
$user = "此处填写数据库用户名" ; |
04 |
$password = "此处填写数据库密码" ; |
05 |
$db_name = "此处填写数据库名称" ; |
06 |
|
07 |
$link = mysql_connect( "localhost:3306" , $user , $password ); |
08 |
mysql_select_db( "$db_name" , $link ); |
09 |
echo "<p>数据库清理中,请稍等......" ; |
10 |
$result =mysql_query( "SHOW tables" , $link ); |
11 |
while ( $currow =mysql_fetch_array( $result )) { |
12 |
mysql_query( "drop TABLE IF EXISTS $currow[0]" ); |
13 |
echo $currow [0]. "<br>" ; |
14 |
} |
15 |
echo "清理成功!</p>" ; |
16 |
|
17 |
?> |
---
转载请注明本文标题和链接:《PHP代码清理数据库》
发表评论