-2

I want to assign two values to one variable in php.I am using codeigniter and in model i need to assign two values to one variable.How i do that. Here is code of my model.

public function close_bid()
{
    $status = 'Assign';


    $this->db->where('bid_status',$status);

    return $this->db->get("project_bid")->result();
}

I want if $status is equal to assign or $ status is equal to Complete then where condition is checked. I am trying that but its not working:

$status = 'Assign' || $status = 'Complete';

1 Answers1

0

If you want to assign 2 values in 1 variable used array. but in your case you don't need that.

you can do this:

$this->db->where('bid_status', 'Assign');
$this->db->or_where('bid_status', 'Complete');
return $this->db->get("project_bid")->result();

or this:

$status = ['Assign', 'Complete'];

return $this->db->query("
         SELECT *
         FROM project_bid
         WHERE bid_status = ?
         OR bid_status = ? ", $status)->result();

I did not test that, but i think it will work.

winnie damayo
  • 426
  • 9
  • 17