Re: 2 columns same name cuz of a join
| From: | Jason Murray | Date: | Mon, 26 Feb 2001 21:28:35 +0000 |
| Subject: | Re: 2 columns same name cuz of a join | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41735@lists.php.net to get a copy of this message | ||
Jason Jacobs wrote:
>
> Hi again. :) Does anyone know how to reference a value in an array or
> object if the returned table has 2 fields of the same name. IE, I am
> querying 2 tables and returning an id value from each. On both tables, the
> id fieldname is "id". I know I can access the vals like $array[0] and
> $array[1], but is there a way I can fetch_object do do that? Can I
> reference them like $object->table1.id and $object->table2.id? I would
> assume not since it just makes a new table when it returns the data. Thanks
> for the help, and I hope my question is clear. :)
>
> Jason
>
Something like
select tbl1.id as tbl1_id, tbl2.id as tbl2_id ....
$ob->tbl1_id;
should work... o fthe top of my head.
Jason
--
Jason Murray
Developer
http://www.jwebmedia.com/
1 877 525 jWEB