Re: [PHP] temp tables

From: "Richard Lynch" <ceo(at)l-i-e(dot)com>
To: "Cima" <ruel(dot)cima(at)facinf(dot)uho(dot)edu(dot)cu>
Cc: php-general(at)lists(dot)php(dot)net, pgsql-novice(at)postgresql(dot)org
Subject: Re: [PHP] temp tables
Date: 2005-04-28 03:50:44
Message-ID: 1141.67.184.124.249.1114660244.squirrel@www.l-i-e.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, April 27, 2005 9:45 pm, Cima said:
> im working with php 4 and postgresql 8 and in my php script id like to
> create a temp table on my database server. how do i do this? how do i
> verify it was created?
>
> i tried the following:
>
> $sql = "create temp table s_info(a int, b text) on commit delete rows ";
>
> pg_query($dbh,$sql);
>
>
> $dbh is my connection.

Did it print an error message?

What was the return value of pg_query()?

Did you check http://php.net/pg_last_error

What happens if you then do:
$sql = "insert into s_info(a, b) values(1, 'Test')";
pg_query($dbh, $sql) or die(pg_last_error());

$sql = "select * from s_info";
$sinfo = pg_query($dbh, $sql) or die(pg_last_error());
$srow = 0;
while (list($a, $b) = @pg_fetch_row($sinfo, $srow++)){
echo "a: $a b: $b<br />\n";
}

What makes you think it didn't work?

--
Like Music?
http://l-i-e.com/artists.htm

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Joshua D. Drake 2005-04-28 04:13:58 Re: [PHP] temp tables
Previous Message Keith Worthington 2005-04-28 03:20:51 Re: Copy data from table to table