PDA

View Full Version : PHP with MySQL



Recursion
01-05-2006, 07:33 AM
How would I use a PHP file to clear a Database of ALL tables?

Tomm
01-05-2006, 07:52 AM
mysql_select_db("db_name", $mysqlconnectionvar);
mysql_query("DROP TABLE `table_name`;");

Splinter
01-05-2006, 07:52 AM
I think the query:

DELETE FROM tablename would suffice but im not sure..

As Toms deletes the table and you seem to want it just to be cleared "/

Recursion
01-05-2006, 07:55 AM
I want the Database cleared of all Tables

Splinter
01-05-2006, 07:57 AM
then use:
mysql_query("DROP TABLE `table_name`;");
for each table =]

nets
01-05-2006, 09:59 AM
To delete everything from the table, but not the actuall table:

TRUNCATE TABLE 'tableName'

To delete the table and the data it contains:

DROP TABLE 'tableName'

Want to hide these adverts? Register an account for free!