Re: Interbase fields by name?
| From: | Meir kriheli | Date: | Thu, 19 Oct 2000 21:58:04 +0000 |
| Subject: | Re: Interbase fields by name? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3814@lists.php.net to get a copy of this message | ||
Hi Todd
On Thu, 19 Oct 2000, Todd Cary wrote:
> My code for accessing records in Interbase is below. However, I have to
> use the subscript for the fields rather than using the field name. Does
> anyone have code that is working *for Interbase* where the fields are
> referenced by name?
>
> Todd
Try using ibase_fetch_object. It returns a pseudo-object, with the
fields as object vars.
e.g (taken from the PHP manual):
<?php
$dbh = ibase_connect ($host, $username, $password);
$stmt = 'SELECT * FROM tblname';
$sth = ibase_query ($dbh, $stmt);
while ($row = ibase_fetch_object ($sth)) {
print $row->email . "\n";
}
ibase_close ($dbh);
?>
Pay attention to the case of the vars. For more info see:
http://www.php.net/manual/function.ibase-fetch-object.php
--
Meir Kriheli
MKsoft computer systems
"There's someone in my head but it's not me" - Pink Floyd