-
Pet Projects
Tag Archives: Zend_Db
Steve Hollis first blog post about practical nested database transactions using Zend_Db. He writes really well and his blog is very readable. I love reading long text in Serif Thanks Steve! His solution: The Solution Disclaimer: This solution is adapted … Continue reading
I would never make it to any PHP Conference, so I would have to be satisfied by the replays and slides. I got these from the DPC slides found here (pdf). function query($sql, $bind = array()) – uses prepared statement … Continue reading
I was in a situation that I need to connect to 2 different databases. I started by putting the additional credentials to login into the second database inside my config file: /application/config/app.ini [production] database.adapter = "PDO_MYSQL" database.params.host = "localhost" … Continue reading
Let’s say I have a Model named: Psdump.php and it is found in /models/Psdump.php < ?php /** * Psdump.php * /opt/apache2/htdocs/apps/org_v2/application/models/Psdump.php */ require_once APPLICATION_PATH.’/models/PsdumpTable.php’; //I will need this class Psdump extends Zend_Db_Table { protected $_table; public function … Continue reading
I love this, since I do not have to type [' and '] at the end of each field. Typing -> is easier! $db = Zend_Registry::get(’db’); $db->setFetchMode(Zend_Db::FETCH_OBJ); $result = $db->fetchAll("SELECT * FROM user_roles"); foreach($result AS $row) { echo $row->fieldA; //instead … Continue reading