SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    Fluffy Kitten Programmer~ Elledan's Avatar
    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.

  2. #2
    Dumb PHP codin' cat
    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.

  3. #3
    exit();
    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>

  4. #4
    Dumb PHP codin' cat
    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.

  5. #5
    exit();
    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.

  6. #6
    Dumb PHP codin' cat
    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.

  7. #7
    Fluffy Kitten Programmer~ Elledan's Avatar
    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 lazy
    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •