Welcome Guest, Not a member yet? Register   Sign In
'Greater than' operator is working but not 'lesser than' in Model class
#1

This is my example table:

Code:
infoID   userNAME
1         Alpha
2         Bravo
3         Charlie
4         Delta
5         Echo

This is my model:
Code:
public function get_next_info() {
    $a = $this->input->post('infoID');        
    $this->db->where('infoID >', $a);        
    $query = $this->db->get('info');                 
       return $query->row_array();            
}
    
public function get_previous_info() {
    $a = $this->input->post('infoID');        
    $this->db->where('infoID <', $a);        
    $query = $this->db->get('info');                 
       return $query->row_array();
}
 
My issue is 'get_next_info' is working fine in my view,when a 'NEXT' button is pressed,the data is able to display from 1 to 2 to 3 and so on,But when a 'PREVIOUS' button is pressed,the data straight go back id no1,instead of  3 to 2 to 1 as intended.

Anything wrong with my 'get_previous_info' query?
Reply


Messages In This Thread
'Greater than' operator is working but not 'lesser than' in Model class - by Leolabs - 07-11-2018, 01:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB