RE: [PHP] $row and alias
| From: | John Holmes | Date: | Tue, 30 Jul 2002 23:47:03 +0000 |
| Subject: | RE: [PHP] $row and alias | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110436@lists.php.net to get a copy of this message | ||
Use ibase_fetch_row() instead... Then you can use count() on it to see
how many columns there are and loop through them all.
---John Holmes...
> -----Original Message-----
> From: Saci [mailto:nospam@bol.com.br]
> Sent: Tuesday, July 30, 2002 2:44 PM
> To: php-general@lists.php.net
> Subject: [PHP] $row and alias
>
> I would like to show some fields based on a Interbase database,
everthing
> is
> working when i type the fields name usinf $row-> field
>
> something like this
>
> while ($row = ibase_fetch_object($sth)) {
> echo "<TR><TD>$row->RAZAO_SOCI</TD>";
> echo"<TD>$row->ENDERECO</TD></TR>\n" ;
> }
>
> But I would like to make a generic output without declaring the field
name
> in code.
>
> I discover that the code bellow show-me the field names and alias for
any
> feetched database
>
> while ($row = ibase_fetch_object($sth)) {
> for ($i=0; $i < $coln; $i++) {
> $col_info = ibase_field_info($sth, $i);
> echo "name: ".$col_info['name']." ";
> echo "alias: ".$col_info['alias']."";
>
> }
>
>
> How can I output the data field content based on field alias (
> .$col_info['alias'].""; )
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php