note 10616 modified in pg_fieldname by ronabop
| From: | ronabop@php.net | Date: | Sat, 13 Jan 2001 04:38:08 +0000 |
| Subject: | note 10616 modified in pg_fieldname by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9745@lists.php.net to get a copy of this message | ||
The pg_fieldname function only returns the unqualified name from the select statement. example:
select c.name, con.name from customer c, contacts con where con.customer_id = c.id;
pg_fieldname will return "name" for both fields instead of c.name and con.name.
This is a PostgreSQL limitation, not a PHP limitation.
if you need different field names you should use :
select c.name as customer_name, con.name as contact_name from customer c, contacts con where
con.customer_id = c.id;
then pg_fieldname will return "customer_name" and "contact_name"
http://www.php.net/manual/pg-fieldname.php