Last Updated: 14 Oct 2023
|
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
backend-tech:php:mysqli-vs-pgsql-vs-pdo-vs-zend_db [May 11, 2009 06:46 AM] dordal created |
backend-tech:php:mysqli-vs-pgsql-vs-pdo-vs-zend_db [Oct 13, 2023 10:48 AM] 111.225.148.67 removed |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | = pgsql vs. mysqli vs. PDO vs. Zend_DB in PHP = | ||
+ | |||
+ | If your PHP app needs to talk to a database, there' | ||
+ | |||
+ | Many developers say that you should use PDO, but I disagree. The two primary reasons for using PDO are: | ||
+ | * You can connect to any major database with the same interface, which makes your application portable across databases. Simply change the connection string, and voila, you're talking to SQL Server instead of MySQL! | ||
+ | * Because you're only using one interface, you don't have to remember different PHP commands for dealing with different databases. No need to worry that [[http:// | ||
+ | |||
+ | Those are both very valid points, and on the surface they sound great. But consider this: | ||
+ | * If you're building anything but the most trivial application, | ||
+ | * While being able to switch databases sounds great in theory, how often have you // | ||
+ | * Same thing goes for you, as a developer: how many databases do you actually use on a day-to-day basis? In the entire time I've been working with PHP, I've only used two in any serious production capacity: MySQL and PostgreSQL. PDO might be more attractive if I were consantly switching between four or five different databases, but its not that hard to remember just the '' | ||
+ | |||
+ | I don't hate PDO, and have used it in the past for simple apps, but I generally think you're better off using a native extension. | ||
+ | |||
+ | === What about Zend_DB? === | ||
+ | |||
+ | As of this writing (May 2009), Zend has a new database interface module out, called [[http:// | ||
+ | |||
+ | I've been using Zend_DB recently, mainly with the mysqli engine, and so far I like it. It provides ready-made versions of a lot of the helper functions that I usually write myself, like '' | ||