This blog site is not meant to be any information that is distributed to the general public. It is to serve as shared documentation between the DNSTC developers; however, if you find something useful and would like to use it, go right ahead.

Monday, February 14, 2011

Delete All Records in a MySQL Table – Quick Reference

Occasionally you may need to remove all records from a database table to reset the data. The following code is a quick reference to delete all of the records within a table. It can be copy/paste into a PHP page, then it will work after modify the reference to the database and/or tables.

This is just quick reference to remove all records from a database:

PHP Code:


$deleteSQL = "DELETE FROM inventory";
mysql_select_db($database_database, $databse);
$Result1 = mysql_query($deleteSQL, $database) or die(mysql_error());

No comments:

Post a Comment