A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Tag Archives: Zend_Db

Zend Framework: How to use nested transactions with Zend_Db and MySQL

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

Posted in General | Tagged , , , , | 4 Comments

Zend Framework: SQL Injection Prevention from DPC Slides

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

Posted in General | Tagged , , , , , | 3 Comments

Zend Framework: Connecting to 2 databases

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

Posted in General | Tagged , , , | 12 Comments

Extending the Models in Zend Framework = Better readability + Easier to maintain

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

Posted in General | Tagged , , | Leave a comment

Zend_Db Changing Fetch Mode

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

Posted in General | Tagged , | Leave a comment