Empty mysql tables

This is a quick guide on how you can empty all of the records that is stored on a mysql table. This is useful for testing purposes, when you want to declutter the database. You can also think of different things where to use the truncate function if you’re creative.

query_database("truncate table purchase_transactions", "onstor", $link);
query_database("truncate table sales_transaction", "onstor", $link);
query_database("truncate table vendor_credit", "onstor", $link);
query_database("truncate table supplier_table ", "onstor", $link);
query_database("truncate table reports", "onstor", $link);
query_database("truncate table customer_table", "onstor", $link);
query_database("truncate table customer_credit", "onstor", $link);
query_database("truncate table categories", "onstor", $link);

That’s how you do it the long method. Here are some supplements if you want to learn how to do it in a shorter way:



2 thoughts on “Empty mysql tables

  1. Pingback: PHP Code suddenly doesn’t work? « Data Integrated Entity

  2. Pingback: Introduction to premium tutorials « Data Integrated Entity

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s