Re: postgresql database access failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



e-letter wrote:

> The file was changed:
> 
> ...           $value=pg_fetch_result($query,1,1);
> echo 'all files' . var_dump($value);
> ...
> 
> The resultant web page produces:
> 
> bool(false) all files
> 
> The php file was changed again:
> 
> ...           $value=pg_fetch_result($query);
> echo 'all files' . var_dump($value);
> ...
> 
> The resultant web page produces:
> 
> NULL all files
> 
> The error log shows:
> 
> ...PHP Warning:  pg_fetch_result(): supplied argument is not a valid
> PostgreSQL result resource...
> 
> The objective is to learn how to extract data from a database and
> print to a web browser, but not much progress made so far..!

There is a good example of how to use pg_fetch_result in the docs at
http://php.net/manual/en/function.pg-fetch-result.php.

On the basis of the code shown here, it's a bit hard to determine exactly
what your problem is; however the odds are that the error "supplied
argument is not a valid PostgreSQL result resource" results from a SQL
syntax error, or possibly that you have failed to open a connection to
pgsql. However, there are some tools to help you; see
http://php.net/manual/en/function.pg-result-error.php

For future reference, it helps to post all the code that is relevant to your
problem, so in this case it would help, for example, to see how you are
making the connection to pgsql and how the $query variable is populated.



Cheers
-- 
David Robley

A seminar on Time Travel will be held two weeks ago.
Today is Boomtime, the 49th day of Discord in the YOLD 3177. 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux