• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

phpmyadmin

neG.oNe

New Member
is there a way to drop all the tables and data with phpmyadmin instead of choosing each one seperately and dropping them....I think I saw somewhere where you could check each one off but I'm not sure
 
Why not just type:

DROP table <tablename>;
DROP table <tablename>;
DROP table <tablename>;
DROP table <tablename>;
DROP table <tablename>;
DROP table <tablename>;

hehehe
 
I made a script, here's the code:
PHP:
<html><body>
<?php
$db_con = mysql_connect("localhost", "root", "password");
$DB = 'The DB you want to empty';

/*****Don't edit after here*****/
mysql_select_db($DB);
$tables = mysql_list_tables($DB);
while (list($bla)=mysql_fetch_array($tables))
{
  echo "Dropping table $bla...";
  if(!mysql_query("DROP TABLE $bla"))
  {echo "ERROR<br>\n";}else{echo "OK<br>\n";}
}
?>
</body></html>
With an easy if statement, you can even use it to only delete table with a special name (eg, all that start with 'nuke_')
 
Originally posted by gyrbo
I made a script, here's the code:
PHP:
<html><body>
<?php
$db_con = mysql_connect("localhost", "root", "password");
$DB = 'The DB you want to empty';

/*****Don't edit after here*****/
mysql_select_db($DB);
$tables = mysql_list_tables($DB);
while (list($bla)=mysql_fetch_array($tables))
{
  echo "Dropping table $bla...";
  if(!mysql_query("DROP TABLE $bla"))
  {echo "ERROR<br>\n";}else{echo "OK<br>\n";}
}
?>
</body></html>
With an easy if statement, you can even use it to only delete table with a special name (eg, all that start with 'nuke_')
hehe thanks for the script, the first time it only deleted a few and the rest errors but did it again and did the whole thing...
 
Back
Top