Suppose I have two table USER and MESSAGE
USER - id,name
MESSAGES - id,message_from,message_to,message_message
So inorder to join I use this co
SELECT m.*,u1.*,u2.* FROM MESSAGES m
INNER JOIN USER as u1
ON(m.message_from = u1.id)
INNER JOIN USER as u2
ON(m.message_to = u2.id)
So now when i print_r out the result in codeigniter it doesn’t have the user data for the user message_to.
And I guess even if it return data for both user then it should have some prefixes to differentiate
So how should I do that ?
Thanks and Regards
It is best to avoid using SELECT * syntax.
I would suggest you specify the columns you want back and give those columns whose names are not unique an alias.