Warning: Supplied argument is not a valid PostgreSQL link resource - Mailing list pgsql-general

From Jan Gravgaard
Subject Warning: Supplied argument is not a valid PostgreSQL link resource
Date
Msg-id 3e5f49c3$0$19098$ba624c82@nntp02.dk.telia.net
Whole thread Raw
List pgsql-general
Hi there

I get the above mentioned warning when I execute php that contacts the
postgre database.

I use the following functions to connect to db

Some of the text is in danish :-)

function aabn_forbindelse_og_vaelgdb() {
    $dbcon = pg_connect("host=XXX port=5432 dbname=XXX user=XXX
password=XXX");
      if (!$dbcon) {
            echo "Kunne ikke oprette en forbindelse til PostGre databasen.";
      }
      return $dbcon;
    }

    function luk_forbindelse($dbcon) {
      if(!pg_close($dbcon)) {
            echo "Kunne ikke lukke forbindelsen til PostGre!";
        }
    }

    function sql_spoerg($dbcon, $query)
    {
      $resultat = pg_exec($dbcon, $query);
          if(!$resultat) {
                echo "Kunne ikke udf�re: <em>$query</em>";
          }
    }

    function sql_spoerg_og_faa_svar($dbcon, $query)
    {
      $resultat = pg_exec($dbcon, $query);
      $resultat_array = array();
      if(!$resultat)
      {
        echo "Kunne ikke udf�re: <em>$query</em>";
      }
      while($raekke = pg_fetch_array($resultat))
      {
        $resultat_array[] = $raekke;
      }
          return $resultat_array;
      }

Anyone who knows whats wrong ?



pgsql-general by date:

Previous
From: evon600c
Date:
Subject: Re: how to determine OID of the row I just inserted???
Next
From: jan@klog.dk (Jan Gravgaard)
Date:
Subject: Warning: Supplied argument is not a valid PostgreSQL link resource