#18713 [NEW]: pg_exec does not return objectid from insert

From: Date: Fri, 02 Aug 2002 21:01:08 +0000
Subject: #18713 [NEW]: pg_exec does not return objectid from insert
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15864@lists.php.net to get a copy of this message
From: jam@newimage.com Operating system: redhat 7.3 PHP version: 4.1.2 PHP Bug Type: PostgreSQL related Bug description: pg_exec does not return objectid from insert I've found what I believe is a bug in the php postgresql module. Consider this code: 1 $db = pg_connect("dbname=phpserve user=apache"); 2 3 $sql = "insert into orders(userid, datestamp, completed) 4 values ('0', 'now()', 'f')"; 5 $res = pg_exec($sql) or die("invalid query"); 6 7 print_r($res); 8 print "<br />"; 9 print count($res); 10 $foo = pg_fetch_row($res, 0); 11 print_r($foo); the insert runs fine. the output is "Resource id #2" (which is good), then a 1 (for the count, which is also good) and then an error for the pg_fetch_row() call (error is "PHP Warning: Unable to jump to row 0 on PostgreSQL result index 2 in /var/www/html/phpserve/test.php on line 11") which is where the problem lies. the result from an insert should be the objectid of the record. I'm willing to entertain the possibility that I've done something wrong with my code, and that this isn't a bug in php. -- Edit bug report at http://bugs.php.net/?id=18713&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18713&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18713&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18713&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18713&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18713&r=support Expected behavior: http://bugs.php.net/fix.php?id=18713&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18713&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18713&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18713&r=globals

« previous php.bugs (#15864) next »