Get the current or last sequence value in Postgres
| From: | Bernie Huang | Date: | Tue, 18 Jul 2000 21:53:17 +0000 |
| Subject: | Get the current or last sequence value in Postgres | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-1253@lists.php.net to get a copy of this message | ||
Hello,
I tried
$query = "SELECT CURRVAL('test_seq')";
$exec_status = pg_exec($conn_status, $query) or die
("<b>Error:</b><br>Unable to get id");
$id = pg_fetch_array($exec_status, 0);
echo $id;
but it echoes "Array" as return value. Did I do anything wrong? How else
can I get the current or last value of a sequence? Thank you.
- Bernie