PostgreSQL and PHP
PostgreSQL and PHP
От:
"James Macken" <jmac@nemesis.com.au>
Дата:
To those of you who use PHP with PostgreSQL, I'm trying to do a simple select inside a ".php3" script. The php3 script simply says something like (the linux machine is not turned on so I can't grab it exactly): and all I get is (in the resulting web page): whatever In other words, it doesn't print out on the web page the query that I just made. Now have added the "nobody" web user to the list of authorised people and I have granted permission for nobody to do anything he likes to mydb. Other things work however such as the echo command above and the "info" php command. Any ideas? James
Re: [SQL] PostgreSQL and PHP
От:
Stefano Brozzi <sbrozzi@bci.it>
Дата:
James Macken wrote:
>
> To those of you who use PHP with PostgreSQL,
>
> I'm trying to do a simple select inside a ".php3" script. The php3 script
> simply says something like (the linux machine is not turned on so I can't
> grab it exactly):
>
> $database = pg_connect("","","","mydb");
> pg_exec($database, "select * from mytable");
> echo "whatever"
> ?>
>
> and all I get is (in the resulting web page):
>
> whatever
>
I guess you have more lines in your php script,
have you lines like these:
$result = pg_Exec ($database, $sqlStr);
if (!$result) { echo "An error occured.\n"; exit;
}
for($i=0; $iRe: [SQL] PostgreSQL and PHP
От:
Giampiero Raschetti <giampiero.raschetti@popso.it>
Дата:
Did you really read the manual ?
>From the php postgresSQL manual (pg_fetch_array)
Example 1. PostgreSQL fetch array
Prev
James Macken wrote:
>
> To those of you who use PHP with PostgreSQL,
>
> I'm trying to do a simple select inside a ".php3" script. The php3 script
> simply says something like (the linux machine is not turned on so I can't
> grab it exactly):
>
> $database = pg_connect("","","","mydb");
> pg_exec($database, "select * from mytable");
> echo "whatever"
> ?>
>
> and all I get is (in the resulting web page):
>
> whatever
>
> In other words, it doesn't print out on the web page the query that I just
> made. Now have added the "nobody" web user to the list of authorised people
> and I have granted permission for nobody to do anything he likes to mydb.
>
> Other things work however such as the echo command above and the "info" php
> command.
>
> Any ideas?
>
> James
>
> ************
--
Best Regards
----------------------------
Ing. Giampiero Raschetti
Sistemi Innovativi
Banca Popolare di Sondrio
----------------------------