View Single Post
  #12 (permalink)  
Old Jan 17th, 2008, 20:09
geyids geyids is offline
Reputable Member
Join Date: Mar 2007
Location: Kenya
Age: 19
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to geyids Send a message via Yahoo to geyids Send a message via Skype™ to geyids
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$i0); 
     if (
substr($tablename03) == "phpbb_"
     { 
     if (
mysql_query("drop TABLE ".$tablename)) print "droped ".tablename."!<br />"
     } 
    } 
    
?>
Reply With Quote