Welcome Guest, Not a member yet? Register   Sign In
Codeigniter ignoring $this->db->close() ?
#1

[eluser]fiat[/eluser]
Hi There,

I'm having trouble with a database connection persisting even thou i call $this->db->close();

Below is my code

Code:
$beach_name = $this->Slsa_model->getBeachName($this->uri->segment(3));
    
    $data = array(
    'beach_key' => $this->uri->segment(3),
    'assessment_key' => $this->uri->segment(4),
    'name' => $beach_name
    );

        $this->load->database('postgres');
        $this->db->insert('beach', $data);
           $this->db->close();


Model

Code:
function getBeachName($beach_key)
    {
     $this->load->database('absamp');
         $sql = "SELECT * FROM beaches WHERE beach_key = ? ";
         $query = $this->db->query($sql, $beach_key);
        
        $row = $query->row_array();
           $this->db->close();

        return $row[beach_name];
    }

Now the issue is, when I try to perform the INSERT into POSTGRES database, i get the error message saying

Code:
ERROR: relation "beach" does not exist at character 13

After a bit of scratching around, it seems the insert is trying to apply to the ABSAMP database, not the POSTGRES

Why would this connection be persisting even thou I have closed the DB connection?


Messages In This Thread
Codeigniter ignoring $this->db->close() ? - by El Forum - 04-20-2011, 05:17 AM
Codeigniter ignoring $this->db->close() ? - by El Forum - 04-20-2011, 05:33 AM
Codeigniter ignoring $this->db->close() ? - by El Forum - 04-20-2011, 05:38 AM
Codeigniter ignoring $this->db->close() ? - by El Forum - 04-20-2011, 05:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB