Have a look at using the PEAR DB extension as well... saves a lot of time.