note 12467 modified in ref.pgsql by yohgaki

From: Date: Tue, 09 Apr 2002 02:18:35 +0000
Subject: note 12467 modified in ref.pgsql by yohgaki
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-28988@lists.php.net to get a copy of this message
If you want to extract data from select statements, you need to store the result index, and then apply pg_result to that value. Basically, do this $resultIdx = pg_query ($database, "select * from tablename"); $mySelect = pg_fetch_result($resultIdx, 0, 0); // gets column 0 of tuple 0 echo("My select: [".$mySelect."]"); I'm new to php and had to do some fiddling around to work this out. It's reasonably elementary, but not demonstrated by the examples on these pages. Hopefully it will come in useful to someone else. --was-- If you want to extract data from select statements, you need to store the result index, and then apply pg_result to that value. Basically, do this $resultIdx = pg_exec ($database, "select * from tablename"); $mySelect = pg_result($resultIdx, 0, 0); // gets column 0 of tuple 0 echo("My select: [".$mySelect."]"); I'm new to php and had to do some fiddling around to work this out. It's reasonably elementary, but not demonstrated by the examples on these pages. Hopefully it will come in useful to someone else. http://www.php.net/manual/en/ref.pgsql.php

« previous php.notes (#28988) next »