Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
"Where" with null values
  • I have a table with a user_id collumn which can be null. All rows with user_id=NULL belongs to every user. I am trying to write an condition for this models. (USER_ID is a constant which I fill with the user_id in the controller before methode.

    protected static $_conditions = array(
    'where' => array(
    array('user_id', 'IN', array(USER_ID,'NULL') )
    )
    );

    It doesn't work since it only selects the rows where the user_id is set. How can I fix this?


  • You're passing 'NULL', which is a string, so that is not going to work, you need to remove the quotes.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion