Connecting to a database
Consider using mysqli instead of mysql:

mysqli

Mysqli (the "i" stands for "improved") is more OO-friendly and has better security.  It also seems like the standard mysql functions are being deprecated (some of them anyway).