Alex Rivera | Logout

CakePHP: Find where field is not null

Asked 2009-07-28T21:54:01.523
52

I need to select all rows where User.site_url is not null. It's simple enough to do this in a regular MySQL query but how is this done in CakePHP?

The manual mentions the following:

array ("not" => array (
        "Post.title" => null
    )
)

I have tried the following but it's still returning everything

$this->User->find('all', array('conditions' => array('not' => array('User.site_url'))));
Edit
Report

1 Answer

17

Your just missing the null

$this->User->find('all', array('conditions' => array('not' => array('User.site_url'=>null))));
answered 2009-07-28T22:03:10.660

Your Answer