You really shouldn't be using mysql_* functions, at the very least use mysqli_* or PDO
Thanks, I hadn't read about that until today.
Personally I use more abstracted methods in a framework, but that might have made my example more complicated instead of less... $db->query()