mysql, mysqli, or mysqlpdo connection?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
big0mike
Forum Newbie
Posts: 5
Joined: Thu Jul 17, 2008 12:52 pm
Location: Peoria AZ

mysql, mysqli, or mysqlpdo connection?

Post by big0mike »

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?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: mysql, mysqli, or mysqlpdo connection?

Post by Christopher »

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)
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Re: mysql, mysqli, or mysqlpdo connection?

Post by jmut »

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.
Post Reply