http://rafb.net/p/OdT5zc28.html - Here's the same code color coded. Soon as I opened the code in my editor I noticed I missed a brace. Follow the link to the updated code. You should be able to just establish your connection after that output buffering on line 2 (haha, which I also forgot. Just add: ob_start();) and then edit those sql queries and be on your way.