pentium10 Posted October 19, 2008 Share Posted October 19, 2008 Hello, I have a rule setup on PostgreSQL to return a column after insert. CREATE RULE get_projectkey_on_insert AS ON INSERT TO projects DO SELECT currval(('projects_id_seq'::text)::regclass) AS id; I use pg_prepare, and pg_execute $sql="insert into " . $this->TableName. " (username,companycode,projectname) values ($1,$2,$3)"; $this->result=@pg_prepare("projects_insert",$sql) or die(pg_errormessage()); $this->result=@pg_execute("projects_insert", array( $GLOBALS["username"], $GLOBALS["companycode"], '' ) ) or die(pg_errormessage()); My problem is that pg_execute result seams empty and I cannot get the expected value the ID of the projects table. Can you help? Regards, Pentium10 Link to comment https://forums.phpfreaks.com/topic/129120-postgres-pg_prepare-pg_execute-and-insert-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.