I am using MySQL with PHP5. I got to know that ancient mysql_*
functions are no longer maintained and community has begun the deprecation process. So I decided to move away from mysql_*
. The question is where to? I am looking for lighter, simpler and faster way. Somebody tell me which among these (mysqli
and PDO
) is;
- faster
- easy to learn and code
- consumes less space and memory
Note: Tutorial links in beginner level for these two will be helpful.
PDO vs. MySQLi: Which Should You Use?
So if you’re still working with MySQLi, maybe it’s time for a change!
PDO vs. MySQLi: Which Should You Use? - By Dejan Marjanovic
Hope this helps .
Along with the above question, here is a comparison chart;
And the information at Why you Should be using PHP’s PDO for Database Access is really helpful.
About Performance
While both PDO and MySQLi are quite fast, MySQLi performs insignificantly faster in benchmarks - ~2.5% for non-prepared statements, and ~6.5% for prepared ones. The MySQL extension was even faster.