Postgre SQL query error with PHP

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

 



Hello All,
I'm having a problem setting up the query with postgreSQL. I can do
what I won't for the command line but it error when I try it with the
PHP functions.
My errors and code are below.
CODE:
 
<?php
/* Setting up connection to data base. */
$conn = "dbname='cornerstone_property' user='stone' host='localhost'";
/* Connecting to the data base */
$dbconn = pg_connect("dbname='cornerstone_property' user='stone'
host='localhost'");
/* Connecting to see if the connection is true */
if($dbconn == true)
{
echo "Connection to Data Base established";
}
else
{
echo "Connection to Data Base failed";
}
/* End of Connectting to the data base */

$query = pg_query ("
SELECT * FROM property
");
$rows = pg_num_rows($dbconn,$query);

for ($i = 0; $i < $rows; $i++)
{
$data = pg_fetch_result($query, $i);
echo "data: $data[0],
$data[1],
$data[2],
$data[3],
$data[4],
$data[5],
$data[6],
$data[7],
$data[8],
$data[9],
<br>\n";
}
pg_close($dbconn);
?>
Error:
Connection to Data Base established
Warning: pg_query(): Query failed: ERROR: permission denied for
relation property in
/var/www/html/thomas/cis166ae/database/web_users/dan/newrow.php on
line 20

Warning: Wrong parameter count for pg_num_rows() in
/var/www/html/thomas/cis166ae/database/web_users/dan/newrow.php on
line 21

As it show above I can connect to the database but no query.
The part of the code that is error "I Think" is the following.
$query = pg_query ("
SELECT * FROM property
");
Thanks for the help.
Thomas

-- 
------------------------------------------------------------------
Thomas Bonham
thomasbbonham@xxxxxxxxx
bonhamlinux.org
Cell 602-402-9786

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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux