sql order by - PhalconPHP bind params and oerder by -
here code i've tried
$conditions = "category = :id: , status = :status: order :order: limit 3"; $parameters = array( "id" => $cat_id, "status" => 1, "order" => "title asc", ); $posts = posts::find(array( $conditions, "bind" => $parameters ));
everything fine except order by. can please me find out proper way use order in phalconphp?
"bind" , "order" separate parameters:
$conditions = "category = :id: , status = :status:"; $parameters = array( "id" => $cat_id, "status" => 1, ); $posts = posts::find(array( "conditions" => $conditions, "bind" => $parameters, "order" => "title asc", "limit" => 3 ));
this clean , reliable approach - way have in conditions striclty conditions. can change limit/order based on request params without touching condition string.
Comments
Post a Comment