Codeigniter PostgreSQL查询中的非法字符串偏移服务器问题

时间:2014-03-15 06:58:55

标签: php codeigniter postgresql

我们正在使用PostGreSql数据库,当我们运行以下代码单元时,它显示错误。

 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)

型号代码:

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++;
    }
}

1 个答案:

答案 0 :(得分:4)

您可以在此处找到此问题: Postgres db driver insert issue

将第331行更改为

$v = pg_version($this->conn_id); $v = isset($v['server']) ? $v['server'] : 0; // 'server' key