php - Cakephp raw query with paramaters -
is possible in cakephp?
$messages = $this->message->query("select * messages (from_id = :id , to_id = :user_id) or (to_id = :id , from_id = :user_id) order created desc", array( 'id' => $id, 'user_id' => $user_id ) );
you can seek this:
$messages = $this->message->find('all', array( 'conditions' => array( 'or' => array( array('from_id' => $id, 'to_id' => $user_id), array('to_id' => $id, 'from_id' => $user_id), ), ), 'order' => array( 'created' => 'desc', ) ));
php mysql sql cakephp
No comments:
Post a Comment