in reply to DBD::mysql::st execute failed: You have an error in your SQL syntax;

You have a trailing comma in the VALUES section of the SQL. I'd also not bother with $sth and prepare; use the do method and put your bind values (the proper number, that is) in an array (much cleaner).