Skip to content

ORs within WHERE AND clause easier? #1056

@palsypentertainment

Description

@palsypentertainment

The following was my initial code:

$this->db->where( 'f.pendinglive', 1 );
$this->db->orWhere( 'f.statusshort', $status, 'IN' );

but now, I had to do the following to add an extra AND for f.date, as I'm not sure if the extra AND would have any diverse effects if adding it to the above:

$statusList = "'" . implode("','", $status) . "'";
$this->db->where( '( f.pendinglive = 1 OR f.statusshort IN ('.$statusList.') )' );
$this->db->where( "f.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 3 HOUR)" );

I just wanted to know if there's a way to nest an OR within a WHERE AND clause...... If not, it's fine, manually imploding arrays is just an extra step.

TIA.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions