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?
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 =]
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!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.