Обсуждение: error messages (not valid postgresql link resoucre)
|I'm trying to run a query on a database using php and postgres functions
||<?php
db_connect();
$stat = pg_exec($connstr,"SELECT WSID from tblWorkstation ");
while ($row = pg_fetch_rows($stat))
{
print("<option> $row[0]</option>");
}
?>
but I get these error messages. I have tested to see if the connection
is still alive and it is.
||
*Warning*: pg_exec(): supplied argument is not a valid PostgreSQL link
resource in */var/www/html/Databasesite2/Untitled-2*.php on line 27 |
*Warning*: pg_fetch_row(): supplied argument is not a valid PostgreSQL
result resource in */var/www/html/Databasesite2/Untitled-2*.php on line 28
And when I try to close the connection I get theses error messages.
*Warning*: pg_close(): 1 is not a valid PostgreSQL link resource in
*/var/www/html/Databasesite2/Untitled-2.php* on line *61*
*Warning*: pg_host(): 1 is not a valid PostgreSQL link resource in
*/var/www/html/Databasesite2/Untitled-2.php* on line *63*
*Warning*: pg_last_error(): 1 is not a valid PostgreSQL link resource in
*/var/www/html/Databasesite2/Untitled-2.php* on line *64*
Failed to close connection to :
My understanding is if it is not a valid link resource that means its
not available via the connection or that connection is not open.
is this right?
Bob
On Mon, 10 May 2004, Robert Morgan wrote:
> |I'm trying to run a query on a database using php and postgres functions
>
> ||<?php
> db_connect();
You don't set $connstr.
> $stat = pg_exec($connstr,"SELECT WSID from tblWorkstation ");
> while ($row = pg_fetch_rows($stat))
> {
> print("<option> $row[0]</option>");
> }
> ?>
$dblink = pg_connect("dbname=$pg_db user=$pg_userid password=$pg_password")
or die ("Kein Connect zu DB");
$sql = "DELETE FROM adr where nr = $nr";
$result = pg_exec($dblink, $sql);