Reputation: 452
I have a query to a database with a join.
My tables in the database do have some names that are not unique. Ie in the "event" table there is a dsc
coloumn and in module
table there is a dsc
coloumn.
My question is, when i bring the results of a JOIN table query into a php array, how do i select between the two different table fields.
So for one i would say $result['dsc'];
I thought something like $resuilt['event.dsc'];
Doesnt seem too work though :/
Upvotes: 0
Views: 60
Reputation: 86366
you can use the alias for column name
select module.dsc as mod_dsc, event.dsc as edsc ....
Upvotes: 0
Reputation: 174957
You can select them as different names in your query:
SELECT `module`.`dsc` AS `mdsc`, `event`.`dsc` AS `edsc` ...
Then,
$result["mdsc"]; $result["edsc"];
Upvotes: 1