Your comments just say what the code is doing. I always like to include why.
Little comments (like at the end when you disconnect from the database) just seem superflous when there's no documentation for your while( <INPUT> ) loop at all. Dont get me wrong though! Comments are a Good Thing (tm)
I think that s/\"//g; can be re-written (more efficently?) using tr