php - How to pass variable in find using cakephp and mongo -
i have problem. before, using mysql in cakephp application. how search in database pretty easy like:
$user = $this->user->find('first', array('conditions' => array('id' => $id)));
but when started using mongodb, cannot use $id anymore.
i tried querying:
$id = 1; $user = $this->user->find('first', array('conditions' => array('id' => $id))); // query wont work $id = '1'; $user = $this->user->find('first', array('conditions' => array('id' => $id))); // work
i have contain value in apostrophe's. in application, use session variables not contain apostrophe's.
how make variables not contain apostrophe's , still make queries work.
should have '_id' instead of normal 'id'.
Comments
Post a Comment