postgresql database access failure
| From: | e-letter | Date: | Sat, 30 Apr 2011 08:41:42 +0000 |
| Subject: | postgresql database access failure | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-312579@lists.php.net to get a copy of this message | ||
Readers,
A postgresql database (local disk installation) is successfully
accessed as a normal user:
psql -U username databasename
However, creating a php file to access the database has not been successful.
<html>
<body>
<?php
$db = pg_connect('dbname=databasename user=username');
$query = 'SELECT * FROM databasename';
$value=pg_fetch_result($query,1,0);
echo 'export of database is ',$value,'';
?>
<p>
why does this fail?
</p>
</body>
</html>
The following php code produces the user agent:
<?php
echo '$_SERVER['HTTP_USER_AGENT']';
?>