0

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 :/

2 Answers 2

1

You can select them as different names in your query:

SELECT `module`.`dsc` AS `mdsc`, `event`.`dsc` AS `edsc` ...

Then,

$result["mdsc"]; $result["edsc"];
0

you can use the alias for column name

select module.dsc as mod_dsc, event.dsc as edsc ....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.