form submission call to constructor is required

2019-10-18 06:46发布

问题:

The database is connected via the autoload function

Form submission is unable to submit the called function through class.

code as follows: Blog.php

public function __construct() {
    parent::__construct(); //error at construct() function
    $this->load->helper('url', 'form');
}

public function savedata()
{
    $data //defined as array variable
    $res = $this->db->insert_string($data);
    return true;
}

both functions' belong to the same class.

Below is the error message.

Message: pg_connect(): Unable to connect to PostgreSQL server: missing "=" after 

"localhost" in connection info string

Filename: postgre/postgre_driver.php

Line Number: 154

Backtrace:

File: /Applications/MAMP/htdocs/success_story_ci/application/controllers/Blog.php
Line: 9
Function: __construct


$active_group = 'default';
$query_builder = TRUE;

config/database.php

$db['default'] = array(
    'dsn'   => 'localhost',
    'hostname' => 'localhost',
    'username' => 'puneetchhabra',
    'password' => 'shambhu',
    'database' => 'success_story',
    'dbdriver' => 'postgre',
    'port' => '',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

Be kind and suggest solution to this.

All solution are appreciated.