• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with querys

#11
[eluser]daweb[/eluser]
Hi everybody,

this is my personal solution to solve this problem.

What do u think about that?

Code:
function get_next_prev($cod, $mode)
    {
        switch($mode)
        {
            case 'next' :
                $this->db->select_min('rec.cod', 'cod');
                $this->db->where('rec.cod >', $cod );
            break;
            
            case 'prev' :
                $this->db->select_max('rec.cod', 'cod');
                $this->db->where('rec.cod <', $cod );
            break;
        }
        $query = $this->db->get('rec');
        if($query->num_rows() > 0)
        {
            return $query->row()->cod;
        }
        
        return FALSE;
    }


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.