简体   繁体   English

使用codeigniter将数据插入Postgresql数据库

[英]inserting data into postgresql database with codeigniter

i have a problem when i try to insert a row in my user table in postgresql, eg 我尝试在PostgreSQL的用户表中插入一行时遇到问题,例如

I have the normal insert with active record, $this->db->insert($table,$data) and i get an error something like this: 我有活动记录的正常插入,$ this-> db-> insert($ table,$ data),并且出现类似以下错误:

ERROR: it does not exists the column «user_accounts» in the relation «user_accounts» LINE 1: INSERT INTO "user_accounts" ( "user_accounts" ."uacc_group_fk" 错误:在关系“ user_accounts”中不存在“ user_accounts”列第1行:插入“ user_accounts”( “ user_accounts” 。“ uacc_group_fk”

and i think the problem could be the table name inside the fields that i will insert ( "user_accounts" ."uacc_group_fk"),. 我认为问题可能出在我将要插入的字段内的表名( “ user_accounts” 。“ uacc_group_fk”)。

Do you know how can I avoid this? 你知道我该怎么避免吗? i just want to put the name of fields without table name. 我只想输入没有表名的字段名称。

Thanks in advance! 提前致谢! =) =)

Have you checked that the column "user_accounts"."uacc_group_fk" exists ( with quotes )? 您是否检查了“ user_accounts”。“ uacc_group_fk”列是否存在(带引号)?

this is the data array used in insert_user fuction of https://github.com/haseydesign/flexi-auth/blob/master/library_files/application/models/flexi_auth_model.php : 这是https://github.com/haseydesign/flexi-auth/blob/master/library_files/application/models/flexi_auth_model.php的 insert_user功能中使用的数据数组:

$sql_insert = array(
        $this->auth->tbl_col_user_account['group_id'] => $group_id,
        $this->auth->tbl_col_user_account['email'] => $email,
        $this->auth->tbl_col_user_account['username'] => ($username) ? $username : '',
        $this->auth->tbl_col_user_account['password'] => $hash_password,
        $this->auth->tbl_col_user_account['ip_address'] => $ip_address,
        $this->auth->tbl_col_user_account['last_login_date'] => $this->database_date_time(),
        $this->auth->tbl_col_user_account['date_added'] => $this->database_date_time(),
        $this->auth->tbl_col_user_account['activation_token'] => $activation_token,
        $this->auth->tbl_col_user_account['active'] => 0,       
        $this->auth->tbl_col_user_account['suspend'] => $suspend_account        
    );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM