| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Apr 2006
Posts: 254
![]() ![]() ![]() | Want to drop every table in your mysql database? This script will delete every table in your database, be careful when you use it. I take no responsibility for the loss of data. Enjoy! <html> <body> <? $username="your_username"; $password="your_password"; $database="your_databse"; $host="your_hostname"; mysql_connect($host, $username, $password); mysql_select_db($database) or die( "Unable to select database"); ????: NamePros.com http://www.namepros.com/code/390831-want-drop-every-table-your-mysql.html $query = "show tables"; $result = mysql_query($query); while ($Row = mysql_fetch_array ($result)) { list ($tables) = $Row; $query2 = "DROP TABLE $tables"; $result2 = mysql_query($query2) or die(mysql_error()); } ?> </body> </html> |
| |