Welcome Guest, Not a member yet? Register   Sign In
DB Where function doesn't resets after running query
#6

[eluser]Benjamin David[/eluser]
Hi ! First of all, thanks for taking the time to take a look at this. Here is my get_media function :

Code:
function get_media($id)
    {
            //$this->db->where(array('id' => $id));
            $this->db->where('id', $id);
            $query = $this->db->get($this->tables['media']);

            
            if($query->num_rows() == 1) {
                $media_row = $query->row();
                $media_object = $this->set_db_object($media_row);
            
                return $media_object;
            }

            return false;
    }

I also give you the set_db_object function. It should be useless, but just in case...

Code:
function set_db_object($media_row) {
        $media_object = new Media_model;
        foreach($media_row as $key => $value) {
            $media_object->$key = $value;
        }            
        
        return $media_object;
    }


Messages In This Thread
DB Where function doesn't resets after running query - by El Forum - 07-09-2007, 09:24 AM
DB Where function doesn't resets after running query - by El Forum - 07-10-2007, 01:18 AM
DB Where function doesn't resets after running query - by El Forum - 07-10-2007, 02:04 AM
DB Where function doesn't resets after running query - by El Forum - 07-10-2007, 09:21 AM
DB Where function doesn't resets after running query - by El Forum - 07-10-2007, 11:33 AM
DB Where function doesn't resets after running query - by El Forum - 07-11-2007, 01:34 AM
DB Where function doesn't resets after running query - by El Forum - 07-11-2007, 08:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB