Jump to content

Table Truncating/Emptying Script


vigiw

Recommended Posts

If by truncate you mean
[code]
TRUNCATE tablename
[/code]

Then you can retrieve the list of tables in the database
[code]
SHOW TABLES;
[/code]

and then iterate through the list, truncating each.
[code]
while (list($tablename) = mysql_fetch_array($result))
{
    mysql_query("TRUNCATE tablename");
}[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.