<?php
/*xuanfunction 删除数据库中有特定前缀的表
*$dbname 数据库名
*$tableflag 表前缀,这里标志出是哪一个用户,如表s00002_goods前缀为s00002
*/
function deldata($dbname,$tableflag){
$db_host = 'localhost';
$db_port = '3306';
$db_user = 'chuangye';
$db_pass = 'chuangye123';
$connect =mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($dbname);
$result = mysql_query("show table status from $dbname",$connect);
$data=mysql_fetch_array($result);
while($data=mysql_fetch_array($result)) {
$table=mysubstr($data[Name],"_");//截取当前表的下划线以前的字符串得到表前缀
if($table==$tableflag){ //判断截取的前缀是否等于自己需要的前缀$tableflag,如果是就删除该表
//测试之用
/*echo $data[Name];
echo "<br>";
echo $table;
echo "<br>";*/ <
/*xuanfunction 删除数据库中有特定前缀的表
*$dbname 数据库名
*$tableflag 表前缀,这里标志出是哪一个用户,如表s00002_goods前缀为s00002
*/
function deldata($dbname,$tableflag){
$db_host = 'localhost';
$db_port = '3306';
$db_user = 'chuangye';
$db_pass = 'chuangye123';
$connect =mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($dbname);
$result = mysql_query("show table status from $dbname",$connect);
$data=mysql_fetch_array($result);
while($data=mysql_fetch_array($result)) {
$table=mysubstr($data[Name],"_");//截取当前表的下划线以前的字符串得到表前缀
if($table==$tableflag){ //判断截取的前缀是否等于自己需要的前缀$tableflag,如果是就删除该表
//测试之用
/*echo $data[Name];
echo "<br>";
echo $table;
echo "<br>";*/ <