Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter Illegal string offset server issue in PostgreSQL query

we are using PostGreSql database, when we run following code unit, it shows error of.

 Severity: Warning
 Message: Illegal string offset 'server'
 Filename: postgre/postgre_driver.php


Message: Cannot modify header information - headers already sent by (output started at       system/core/Exceptions.php:185)

Model Code:

public function tracks_add( $id ) {
    $cnt = 0;
    $date = date('Y-m-d H:i:s');

    $s_title = $this->input->post('s_title');
    $s_singer = $this->input->post('s_singer');
    $s_url = $this->input->post('s_url');

    foreach ($s_title as $s_title) {
        $this->db->set( array('a_id'=> $id, 's_title' => $s_title, 's_singer' => $s_singer[$cnt], 's_url' => $s_url[$cnt], 'date'=> $date) );
        $this->db->insert('soundtracks');

        $cnt++;
    }
}
like image 846
Ahmed iqbal Avatar asked Mar 15 '14 06:03

Ahmed iqbal


1 Answers

You can find this issue here : Postgres db driver insert issue

Change line 331 to

$v = pg_version($this->conn_id); $v = isset($v['server']) ? $v['server'] : 0; // 'server' key 
like image 120
haidarvm Avatar answered Nov 11 '22 11:11

haidarvm