Challenge: Build a Web page that allows you to insert new data into your database. Ensure the input values are filtered appropriately.
Remember: execute() accepts an array of arguments.
To issue the INSERT statements in a transaction, use Perl's exceptions for error-handling:
- 1. Turn on the RaiseError attribute.
- 2. Begin a transaction (either with the AutoCommit attribute or with the begin_work() method).
- 3. Enclose all of the code you want to run in an eval {}; block.
- 4. Check the $@ special variable to see if any errors were raised, rollback() if necessary, or commit otherwise.