Created
May 13, 2015 07:29
-
-
Save iamajeesh/c97f3b31dde49c965daa to your computer and use it in GitHub Desktop.
Drop All Tables in Database Uisng PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mysqli = new mysqli("localhost", "user", "pass", "dbname"); | |
$mysqli->query('SET foreign_key_checks = 0'); | |
if ($result = $mysqli->query("SHOW TABLES")) | |
{ | |
while($row = $result->fetch_array(MYSQLI_NUM)) | |
{ | |
$mysqli->query('DROP TABLE IF EXISTS '.$row[0]); | |
echo $row[0].",\n"; | |
} | |
} | |
$mysqli->query('SET foreign_key_checks = 1'); | |
$mysqli->close(); | |
?> |
This is working Fine. Thanks!!
Awsome
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
woooooooooooooooooooooorking, thanks :D