
Jan 17th, 2008, 20:09
|
|
Reputable Member
|
|
Join Date: Mar 2007
Location: Kenya
Age: 19
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Re: how to delete tables with a prefix
yes the whole thing looks like this now
- PHP: Select all
<?php $db_host = "localhost"; $db_user = "my_user"; $db_password = "my_passwd"; $db_name = "my_name"; $connection = @mysql_connect($db_host, $db_user, $db_password) or die("error connecting"); mysql_select_db($db_name, $connection); //assuming you're connected and have selected the db already $result = mysql_query("SHOW tables") or die(mysql_error()); for ($i = 0; $i < mysql_num_rows($result); $i++) { $tablename = mysql_result($result, $i, 0); if (substr($tablename, 0, 3) == "phpbb_") { if (mysql_query("drop TABLE ".$tablename)) print "droped ".tablename."!<br />"; } } ?>
|