note 10616 added to pg_fieldname
| From: | ccasal at compuserve dot com | Date: | Fri, 12 Jan 2001 16:51:42 +0000 |
| Subject: | note 10616 added to pg_fieldname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9716@lists.php.net to get a copy of this message | ||
Ok, this is NOT a question nor a bug report:
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/function.pg-fieldname.php