Jump to content

Archived

This topic is now archived and is closed to further replies.

chriss

How to drop all tables from db?

Recommended Posts

I understand, but I have no permission to create/drop db.

Share this post


Link to post
Share on other sites

[php:1:c425fae520]<?php

$db_name = \'your db name\' ;

 

$cnx = mysql_connect(\'host\' , \'user\' , \'pwd\');

mysql_select_db($db_name);

$res = mysql_list_tables($db_name);

while ($row = mysql_fetch_row($res)) {

$table = $row[0];

echo \"Dropping $table <br>\";

mysql_query(\"DROP TABLE $table\");

}

?>[/php:1:c425fae520]

 

hth

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.