View Single Post
  #6 (permalink)  
Old Jan 17th, 2008, 18:18
alexgeek's Avatar
alexgeek alexgeek is offline
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: how to delete tables with a prefix

This php should work, found it on a forum.
PHP: Select all

<?php 
//assuming you're connected and have selected the db already 
$result mysql_query("SHOW tables"); 
for (
$i 0$i mysql_num_rows($result); $i++) 

 
$tablename mysql_result($result$i0); 
 if (
substr($tablename03) == "php"
 { 
 if (
mysql_query("drop TABLE ".$tablename)) print "droped ".tablename."!<br />"
 } 

?>
Reply With Quote