php page to reset the database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Antek_Ryu
Forum Commoner
Posts: 34
Joined: Tue Aug 09, 2005 10:55 am

php page to reset the database

Post by Antek_Ryu »

Hi

I have database with 4 tables (Database A) and I have made a copy of this database (Database B). Can someone tell me if users put in bad enteries into database A how I can create a php page that will allow them to reset the database by clicking a button on the php page. Basically copy all Data from Database B and overwrite Database.


Thanks alot
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

SHOW TABLES

TRUNCATE TABLE `tableName`

INSERT INTO `tableName` ( field1, field2, field3, ... ) VALUES( 'value1', 'value2', 'value3', ... )
INSERT INTO `tableName` ( field1, field2, field3, ... ) VALUES( 'value1', 'value2', 'value3', ... )
INSERT INTO `tableName` ( field1, field2, field3, ... ) VALUES( 'value1', 'value2', 'value3', ... )
...
INSERT INTO `tableName` ( field1, field2, field3, ... ) VALUES( 'value1', 'value2', 'value3', ... )
Post Reply