Re: Displaying one field
| From: | Meir kriheli | Date: | Sat, 30 Sep 2000 11:06:49 +0000 |
| Subject: | Re: Displaying one field | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3182@lists.php.net to get a copy of this message | ||
On Thu, 28 Sep 2000, Todd Cary wrote:
> In the following script, how would I just display the field, "PH_CD"?
>
> $stmt = 'SELECT * FROM PHOTOS';
> $sth = ibase_query($stmt,$dbh);
> echo("<TABLE border=1>");
> while ($row = ibase_fetch_row($sth)) {
> echo("<TR>");
> foreach($row as $col){
> echo("<TD>" . $col . "</TD>");
> };
> echo("</TR>");
> };
> echo("</TABLE>");
>
> $col->PH_CD does not work.
You can always use ibase_fetch_object which returns the row as a
pseudo-object, and each column as a variable of that object:
while ($row = ibase_fetch_object($sth)) {
echo("<TR><TD>");
echo $row->PH_CD;
echo("</TD></TR>");
};
Note that var names are case sensitive, as write them as the appear in yiur
db.
To use ibase_fetch_row, you should use:
echo $row['PH_CD']
--
Meir Kriheli
MKsoft computer systems
"There's someone in my head but it's not me" - Pink Floyd