Results 1 to 6 of 6

Thread: PHP with MySQL

  1. #1
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default PHP with MySQL

    How would I use a PHP file to clear a Database of ALL tables?
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  2. #2
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    mysql_select_db("db_name"$mysqlconnectionvar);
    mysql_query("DROP TABLE `table_name`;"); 

  3. #3
    Join Date
    Nov 2005
    Posts
    807
    Tokens
    1,335

    Latest Awards:

    Default

    I think the query:
    Code:
    DELETE FROM tablename
    would suffice but im not sure..

    As Toms deletes the table and you seem to want it just to be cleared "/
    Last edited by Splinter; 01-05-2006 at 07:54 AM.

  4. #4
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    I want the Database cleared of all Tables
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  5. #5
    Join Date
    Nov 2005
    Posts
    807
    Tokens
    1,335

    Latest Awards:

    Default

    then use:
    mysql_query("DROP TABLE `table_name`;");
    for each table =]

  6. #6
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    To delete everything from the table, but not the actuall table:
    Code:
    TRUNCATE TABLE 'tableName'
    To delete the table and the data it contains:
    Code:
    DROP TABLE 'tableName'
    Last edited by nets; 01-05-2006 at 09:59 AM.
    kinda quit.

Posting Permissions

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