PDO (PHP Data Objects) is a PHP extension that grants you generic access to databases in an object-oriented fashion. Perusing stackoverflow I found an excellent tutorial on the subject written by Paul DuBois at kitebird.com.
Using PDO, you’ll stop embedding calls to mysql_ functions across your code, your scripts will improve, your breath will smell mintier, swallows will chirp around your head as you suddenly break into dance. In the rain. Seriously, you will start writing safer, better code. You will be more productive. Your code will be more extensible and maintainable. And isn’t that what this is all about? Plus, swallows, man. Effin’ swallows!
I encourage every fellow PHP programmer that can* to update their mysql_query()es and start using prepared statements like God commanded it.
*You might not be able to use PDO if you’re running older versions of PHP. Shame.