Welcome Guest, Not a member yet? Register   Sign In
active record - where() using < or >
#1

[eluser]Unknown[/eluser]
I want to select some data from database where timestamp is greater than NOW().

Is it possible to do it without manually creating the query?

$this->db->where('col'<'sth2') doesn't work. Is there a plan to add the support for >,<,<=... operator, for example: $this->db->where('col','sth2','>')
#2

[eluser]jedd[/eluser]
Hi marcello100 and welcome tothe CI forums.

I don't use the AR queries, but it looks like you may just have a typo.

Quote:$this->db->where('col'<'sth2') doesn't work.

In the manual it suggests an example of:
Code:
$this->db->where('id <', $id);
#3

[eluser]khagendra[/eluser]
Your code is
Code:
$this->db->where('col'<'sth2')

The logical operator should be with the table field/column. Like this
Code:
$this->db->where('col operator','value')

   $this->db->where('name =','khagendra')
   $this->db->where('id <','10')
   $this->db->where('name !=', $name);
   and so on
#4

[eluser]Unknown[/eluser]
oh, I just found it in the active record user guide, sorry for bothering and thank you Smile
works as expected.




Theme © iAndrew 2016 - Forum software by © MyBB