Refactor for mysqli and PHP 5

I've done more work on refactoring for PHP 5 as well as starting to modify the database access to use mysqli and bound parameters instead of dynamically generating the SQL with string concatenation.

Generally, queries of the form "INSERT INTO $table (columnA, columnB) VALUES ($valueA, $valueB)" are converted to "INSERT INTO $table (columnA, columnB) VALUES (?, ?)" and then $valueA and $valueB get bound into the prepared statement. This is less susceptible to SQL injection attacks.