treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Simple way to delete stuff from a database table.

  • I wrote a code for posting names and dates to database table and a way to retrieve it. But I need a page for a client to delete stuff from the table so I don't have to teach them how to use the phpadmin page.

  • 1) Deleting things from the database should not be simple. Your design should force people to be very careful and deliberate.

    2) End-users probably should not be deleting database records at all. In fact, I'd recommend that the database account used by normal users not even have delete privileges.

    Allow users to "soft delete" ("hide", "un-publish", "ignore", whateveryouwannacallit) records, and then allow an admin to go in periodically to do a "hard" delete. This also allows them to recover items deleted accidentally.

    3) Without knowing anything about your database design, existing code, or even a general understanding of your goal (beyond "delete stuff"), it is impossible to offer a useful solution.