for starters I would move the prepare statements out of the loop. you can execute the same prepared statements multiple times. That ought to get you some major performance increase right away
-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."