Skip to content

Instantly share code, notes, and snippets.

@kwylez
Created June 22, 2011 13:11
Show Gist options
  • Save kwylez/1040064 to your computer and use it in GitHub Desktop.
Save kwylez/1040064 to your computer and use it in GitHub Desktop.
#!/usr/local/zend/bin/php
<?php
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
try {
$db = Zend_Db::factory('Pdo_Mssql', array(
'host' => 'host.name.com',
'username' => 'username',
'password' => 'password',
'dbname' => 'databasename',
'pdoType' => 'dblib'
));
$startDate = "05/01/2011 12:00:00";
$endDate = "06/01/2011 12:00:00";
$stmt = $db->prepare("EXEC sp_name ?, ?");
$stmt->bindParam(1, $startDate, PDO::PARAM_STR);
$stmt->bindParam(2, $endDate, PDO::PARAM_STR);
$stmt->execute();
$rows = $stmt->fetchAll();
Zend_Debug::dump($rows);
$stmt->closeCursor();
} catch (Zend_Db_Adapter_Exception $e) {
print $e->__toString();
} catch (PDOException $e) {
print $e->__toString();
} catch (Zend_Exception $e) {
print $e->__toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment