SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
Jan 7, 2001, 16:07 #1
- Join Date
- Jun 2000
- Location
- Netherlands
- Posts
- 1,356
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is there a way to 'flush' the whole db so that all tables are deleted?
A few points:
-The db can't be dropped and recreated
-The names of the tables in the db are unknown
-I'm talking PHP/mySQL here.
Thanks for your time.www.nyanko.ws - My web-, software- and game development company.
www.mayaposch.com - My personal site and blog.
-
Jan 7, 2001, 16:25 #2
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
<?
$db = mysql_connect("localhost", "", "");
mysql_select_db("dbname");
$result = mysql_list_tables("dbname");
while($row=mysql_fetch_row($result)) {
$tmp = $row[0];
mysql_query("DROP TABLE $tmp");
$tmp ="";
}
?>Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Jan 7, 2001, 17:38 #3
- Join Date
- Jul 2000
- Posts
- 759
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Or you could do:
DROP * TABLES FROM database;
through telnet...correct?
<Edited by mkaufman on 01-07-2001 at 05:47 PM>
-
Jan 7, 2001, 17:54 #4
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
don't think so did you try it?
Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Jan 7, 2001, 18:24 #5
- Join Date
- Jul 2000
- Posts
- 759
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
No I didn't try it..just thought it would be easier then having to enter his username/password into your (no offense, it's a fine script
) script and then uploading.
-
Jan 7, 2001, 18:31 #6
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Matt I tried it and it doesn't work, also in his original request you motice the part about PHP/MySQL leads me to believe he wanted to do it from a script not the command line
-The db can't be dropped and recreated
-The names of the tables in the db are unknown
-I'm talking PHP/mySQL here.
Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Jan 8, 2001, 09:15 #7
- Join Date
- Jun 2000
- Location
- Netherlands
- Posts
- 1,356
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks a lot, freddydoesphp!
That was exactly what I was looking for
BTW you were right, it's for use in a script.
I'm creating an installation script for my new site, and I want to save myself the trouble of deleting all temporary tables I've made in the db.
Maybe I'm just lazywww.nyanko.ws - My web-, software- and game development company.
www.mayaposch.com - My personal site and blog.
Bookmarks