Zend Framework: Connect MySQL

There are so many tutorials about that, but let me add it one more time. You’ve to use the PDO_MYSQL adapter:

// where params include adapter, host
// username, password and dbname
$db = new Zend_Db_Adapter_Pdo_Mysql($params);

and set the default adapter

Zend_Db_Table::setDefaultAdapter($db);

That can be done in the bootstrap or into a front controller plugin!

Related posts:

  1. Zend Framework – quick tutorial (part 3) – front controller plugins
  2. Setting Up Global Cache in Zend Framework
  3. Connect MySQL from Zend Server CE trough unix socket!
This entry was posted in micro tutorial, PHP, zend framework and tagged , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">