Codeigniter Send Data/Parameter to PostgreSQL -
i'am familiar mysql server , try learn postgresql.
before, save/update data ci using mssql store procedure sample:
my controller
$data = array( 'name' => $_post['name'], ); $insert = $this->db->save($data);
my model
public function save($data){ $sp = "insert ?"; $result = $this->db->query($sp,$data); return $this->db->affected_rows(); }
i'am try implement code call postgresql function give me error this
error: syntax error @ or near "insert" line 1: insert e'name'
this postgresql function
create or replace function insert(name varchar(50)) returns refcursor $$ declare nama varchar(50); begin insert dt_anggota values(nama); end; $$ language plpgsql;
whats wrong code or function?
thank you
i found solution code
$sp = "select 'function_name' (?)"; $result = $this->db->query($sp,$data); return $this->db->affected_rows();
Comments
Post a Comment