Welcome Guest, Not a member yet? Register   Sign In
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;
    }




Theme © iAndrew 2016 - Forum software by © MyBB