I've just started using ZF and there's some very handy libraries that save me a lot of time but I can't see the advantage in using their Zend_DB class over mysqli. I don't need PDO as I will always use MySQL as DBMS. And really, how often do you change your DBMS in the middle of a project anyway?
And I'm very comfortable with SQL so don't need their abstraction which just confuses me.
So what advantage is there over this mysqli code in my class constructors and then just SQL queries when I need them?
require_once("database_details.php");
$this->_mysql=new mysqli(DBSERVERHOST,DBUSERNAME,DBPASSWORD,DBNAME);
I donno ZF, but bare mysqli is just ugly. What is your code to get some rows to populate a template?
Let's assume it's just as doleful as
$query = "SELECT * FROM myCity WHERE Name=? AND CountryCode=? AND District=?";
$stmt = $mysqli->prepare($query);
$stmt->bind_param("sss", $val1, $val2, $val3);
$stmt->execute();
$data = array();
if ($result = $mysqli->query($query)) {
while ($row = $result->fetch_row()) {
$data[] = $row;
}
(that's just plain example from the manual)
While with some library you can make it like
$data=$db->getArr("SELECT * FROM myCity WHERE Name=? AND CountryCode=? AND District=?"
$val1, $val2, $val3);
just count number of queries in your usual script and feel the difference.
Also note that you have your precious SQL intact!