Reset MySQL-database with a button on homepage?
Posted on 2009-04-12
Hey! I have a homepage. After you login on that homepage, there is an iframe with a PHP-script that spawns a list of random items from my database (called "items"). There is a button infront of each item where you can delete the item, so it won't ever shown again for you (the user, that is signed on), if you hate that item fx . When you delete items, it actually just adds the items id and your username to a new database called "deleted_items". The script in my iframe checks for items that is in the "deleted_items" and then just don't show those items, before showing the random items.
But what I would like is a button or something on my homepage, that when clicked empties "deleted_items", so that the database will be empty again for that user only and all his or hers items will show again. But you would still be able to delete them again afterwards.
In "deleted_items" is two rows: id (INT3) and username (VARCHAR20).
I think it would be something like this: "check username, delete all id that belongs to that username"
Could someone help me do this? I am still somewhat a beginner to PHP and MySQL. Thanks alot!! I hope it isn't that hard to do :-)