Skip to content

Instantly share code, notes, and snippets.

@scragg0x
Created September 13, 2012 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scragg0x/3718213 to your computer and use it in GitHub Desktop.
Save scragg0x/3718213 to your computer and use it in GitHub Desktop.
PHP Autoload and connect script example
<?php
set_include_path('/usr/share/php/libzend-framework-php/'. PATH_SEPARATOR . ".");
function __autoload($className) {
require $className = str_replace('_', '/', $className) . '.php';
}
$db = new Zend_Db_Adapter_Mysqli(array('host'=>'localhost', 'username'=>'', 'password'=>'', 'dbname'=>''));
/* Example Usage */
/*
$sql = "SELECT * FROM some_table WHERE id = ? LIMIT 1";
$db->fetchRow($sql, $id);
$sql = "SELECT * FROM some_table LIMIT 100";
$db->fetchAll($sql);
foreach($rows as $row){
print_r($row);
}
$sql = "UPDATE some_table SET foo = ? WHERE id = ? LIMIT 1";
$db->query($sql, array($foo, $id));
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment