Skip to content

Instantly share code, notes, and snippets.

@printminion
Last active January 18, 2017 09:31
Show Gist options
  • Select an option

  • Save printminion/e13a33993cfa96fe1e23cb8c7399c92d to your computer and use it in GitHub Desktop.

Select an option

Save printminion/e13a33993cfa96fe1e23cb8c7399c92d to your computer and use it in GitHub Desktop.
example of Zend DB call
<?php
$config = new Zend_Config(
array(
'database' => array(
'adapter' => 'Pdo_Mysql',
//'adapter' => 'Mysqli',
'params' => array(
'host' => 'mysql',
'dbname' => 'database',
'username' => 'dev',
'password' => 'dev',
)
)
)
);
$db = Zend_Db::factory($config->database);
try {
$db->getConnection();
} catch (Zend_Db_Adapter_Exception $e) {
// perhaps a failed login credential, or perhaps the RDBMS is not running
} catch (Zend_Exception $e) {
// perhaps factory() failed to load the specified Adapter class
}
$sql = 'SELECT * FROM bugs WHERE bug_id = ?';
$result = $db->fetchAll($sql, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment