Reset Database

Function Number: 19

Function Name: Reset Database

Link to Function Implementation

Function Type: Special, see below

Description: This function allows a user to click a 'reset' button which will reset the database to its default state (populated with data sufficient to demonstrate functionality). This function first drops all tables in such an order that no key constraint violation error messages occur, then re-creates the tables, and lastly inserts the default records into the tables in such an order that no key constraint violation errors occur.

Primary Users: This function is only useful for demonstrating the database I have designed.

Tables Affected: All tables

Sample Input: Click 'Reset'

Sample Output: "Database State Reset"

Notes: The SQL commands comprising this function are written to a SQL file. The PHP function file_get_contents() is used to read the contents of this file to a string and then mysqli_multi_query is used to execute all query statements.

Main Menu