If you didn't understand something, I highlighted all of misson's corrections.
Sorry, those were a few imperfections, while not critical, it makes it easier to read and manage. First, although it was implied, you should put the database connection handler ($dbh) on the index or on a separate...