Page 1 of 1

php page to reset the database

Posted: Tue Aug 09, 2005 11:17 am
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

Posted: Tue Aug 09, 2005 11:32 am
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', ... )