Welcome Guest, Not a member yet? Register   Sign In
[newbie] help with querys
#1

[eluser]Unknown[/eluser]
hi i want to take all rows from db where date=$today and date=$yesterday and date=$twodaysago

with this i geting $today rows, but how get yesterday and twodaysgo with 1 query im new in ci so help me ;d

Code:
$query = $this->db->get_where('mytable', array('date' =>$today));
return $query->result();
#2

[eluser]Sudz[/eluser]
Hi,

Use this
Code:
$this->db->where('date', $today);
$this->db->or_where('date', $yesterday);
$this->db->or_where('date', $twodaysago);

// Produces: WHERE date = $today OR date = $yesterday OR date = $twodaysago





Theme © iAndrew 2016 - Forum software by © MyBB