February 27th, 2013, 06:26 PM
Hey everyone, I've recently been getting in to using PDO as a database connector. Now, I've read here and there about it and some generic examples of using it but I have yet to see any in depth tutorials or books that utilize PDO.
I can't remember how many times I've picked up a book, or watched a video tutorial just to see them using mysql(i)_* connectors. Anyways, I was wondering if anyone could recommend some good online tutorials or books that actually create something using PDO?
February 27th, 2013, 07:10 PM
February 27th, 2013, 07:25 PM
not sure what kind of in-depth explanations you expect, because writing complex applications has nothing to do with PDO. Both MySQLi and the old MySQL extension can easily be translated into the corresponding PDO code (except maybe for very special cases).
For example, mysqli::prepare() and mysqli::execute() are directly equivalent to PDO::prepare() and PDO::execute() -- the methods even share the same names. The old extension is a bit different, because it doesn't support prepared statements at all. But it should be fairly easy to translate a direct query into a prepared statement.
The PDO interface itself is actually very simple and straightforward. Unless you're doing transactions, pretty much all you'll ever need is prepare() and execute() and from time to time one of the various fetch methods (though a PDO statement can be used directly in a foreach loop).