in reply to Trying to update a mysql table

I've checked the code over and over again and there's nothing wrong with it.

If, as you clarified, this script is working against a local database, and the same script works on a different server, also using a local-to-that-server database, then one of the first things I would suspect are the privileges granted to whatever database user you're using. It's quite possible for a user to have INSERT privs, but not UPDATE privs.

Are privileges the same on both boxes?