Quick Zend_DB Question
Posted: Mon Sep 17, 2007 10:46 am
Two Questions rather...
1) I currently have MySQL 4.1 installed and use the mysql extension (NOT mysqli). I don't want to upgrade to mysqli use and just want to keep using the mysql php extension. But I want to start using the Zend_Db class and notice they offer two ways of connecting to MySQL... PDO and a MySQLi adapter. I can use the PDO method with my current setup (mysql extension), right? My current scripts that don't use PDO but use the mysql extension will still work when I setup my server to work with the Zend_DB (PDO) class, right?
2) Lastly... Just reading through the Zend_Db reference manual... everything looks really good... but I'm not quite sure what replaces the mysql_num_rows() function when using Zend_Db. Example:
How would I go about counting the number of rows returned? Would it be:
Thanks for your advice.
1) I currently have MySQL 4.1 installed and use the mysql extension (NOT mysqli). I don't want to upgrade to mysqli use and just want to keep using the mysql php extension. But I want to start using the Zend_Db class and notice they offer two ways of connecting to MySQL... PDO and a MySQLi adapter. I can use the PDO method with my current setup (mysql extension), right? My current scripts that don't use PDO but use the mysql extension will still work when I setup my server to work with the Zend_DB (PDO) class, right?
2) Lastly... Just reading through the Zend_Db reference manual... everything looks really good... but I'm not quite sure what replaces the mysql_num_rows() function when using Zend_Db. Example:
Code: Select all
$sql = 'SELECT * FROM bugs WHERE bug_id = ?';
$result = $db->fetchAll($sql, 2);Code: Select all
$rowsReturned = count($result);