Welcome Guest, Not a member yet? Register   Sign In
access variables from other function within same class?
#2

[eluser]pistolPete[/eluser]
You need to use a class variable:

Code:
class M_airports extends model {    
    var $id;
    
     function addAirport() {
         $data = array(
            'airportname' => $this->input->post('airportname'),
            'airportwebsite' => $this->input->post('airportwebsite'),
            'airportphone' => $this->input->post('airportphone'),            
        );
        $this->db->insert('aiports', $data);
        $this->id = $this->db->insert_id();    
    }
    function addAirportpics($filename,$filelocation) {      
        $data = array(
            'AirportpicsAirportid' => $this->id,
            'AirportpicsFolder' => $filelocation,
            'AirportpicsFilename' => $filename
        );
        $this->db->insert('airportpics', $data);    
    }
}


Messages In This Thread
access variables from other function within same class? - by El Forum - 09-28-2009, 04:08 AM
access variables from other function within same class? - by El Forum - 09-28-2009, 04:20 AM
access variables from other function within same class? - by El Forum - 09-28-2009, 04:57 AM
access variables from other function within same class? - by El Forum - 09-28-2009, 05:59 AM
access variables from other function within same class? - by El Forum - 06-04-2011, 02:37 AM
access variables from other function within same class? - by El Forum - 06-04-2011, 02:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB