I'm working my way through PHP Solutions by David Powers and we are now beginning the database section. There are three ways to connect, using the mysql, mysql improved, or mysql pdo connection. I know it will depend on your host. I'm with Hostgator so anything I build for myself or my clients will be using a current PHP version, 5.025 as of now I believe. My work's host is all the way back to 4.3. So, my only option with them is mysql (or does the improved version cover 4.3 as well?). No problem. I don't plan on doing a whole lotta developing for them. But, for me, which do I go with?
The book's author says that the push is for PDO. If what he says is true and everyone will eventually be using PDO then I should be studying the PDO tutorials and not worrying about the mysql/i tutorials. But, I don't know if everyone is really pushing towards PDO? Since the two connection types seem to be drastically different I don't wanna waste my time learning something that isn't what everyone else is doing.
Any insight?
mysql, mysqli, or mysqlpdo connection?
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: mysql, mysqli, or mysqlpdo connection?
Everyone is still doing ... all of them. I would recommend either mysqli or PDO because they have both a OO interface and prepared statements.
(#10850)
Re: mysql, mysqli, or mysqlpdo connection?
From own experience I think mysql pdo is only reasonable way to go...speaking performance/memory wise. It's much faster compared with others. No, I have no tests to show..... I have switched between mysqli and pdo mysql on production environment...and with mysqli I got memory exceeded fatal error quite often. This is using the Zend_Framework abstraction layer.....but I doubt layer is relevant in this case.