Skip to content

Instantly share code, notes, and snippets.

@jakemcgraw
Created September 2, 2010 16:20
Show Gist options
  • Save jakemcgraw/562500 to your computer and use it in GitHub Desktop.
Save jakemcgraw/562500 to your computer and use it in GitHub Desktop.
<?php
// More info at http://framework.zend.com/manual/en/zend.db.adapter.html
// Assumes Zend dir is in your include path
require_once 'Zend/Db.php';
$db = Zend_Db::factory('Pdo_Mysql', array(
'host' => '127.0.0.1',
'username' => 'webuser',
'password' => 'xxxxxxxx',
'dbname' => 'test'
));
$db->setFetchMode(Zend_Db::FETCH_OBJ);
// NO BIND/PARAMETER NONSENSE
$result = $db->fetchAll('SELECT * FROM bugs WHERE bug_id = ?', $_GET['bug']);
if (null !== $result) {
echo $result[0]->bug_description;
}
else {
echo "Could not find bug";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment