皆為字串情況 不用定義
$conditions = “name = ?1 AND type = ?2”;
$parameters = array(1 => “Robotina”, 2 => “maid”);
$robots = Robots::find(array(
$conditions,
“bind” => $parameters
));
有字串有數字 則建議定義參數
//Bind parameters
$parameters = array(
“name” => “Robotina”,
“year” => 2008
);
//Casting Types
$types = array(
Phalcon\Db\Column::BIND_PARAM_STR,
Phalcon\Db\Column::BIND_PARAM_INT
);
// Query robots binding parameters with string placeholders
$conditions = “name = :name: AND year = :year:”;
$robots = Robots::find(array(
$conditions,
“bind” => $parameters,
“bindTypes” => $types
));