Created
February 27, 2013 07:15
-
-
Save xboston/5045893 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting( E_ALL | E_NOTICE | E_STRICT ); | |
/** | |
* SQL for model: | |
CREATE TABLE `temp` ( | |
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY | |
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci; | |
*/ | |
//model | |
class Temp extends \Phalcon\Mvc\Model | |
{ | |
public $id; | |
} | |
$di = new \Phalcon\DI\FactoryDefault(); | |
$di->set( | |
'db', | |
function() | |
{ | |
return new \Phalcon\Db\Adapter\Pdo\Mysql(array( | |
"host" => 'localhost', | |
"username" => 'root', | |
"password" => '', | |
"dbname" => 'test',//!!! your DB name | |
)); | |
} | |
); | |
$binds = array( 1 => 1 ); | |
$find_query = array( | |
'conditions' => 'id=?1', | |
'bind' => $binds, | |
); | |
var_dump($binds); | |
$result = Temp::count($find_query); | |
var_dump($binds); | |
/** | |
* array (size=1) | |
1 => int 1 | |
array (size=1) | |
1 => string '1' (length=1) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment