Welcome Guest, Not a member yet? Register   Sign In
getting data from db give wrong result when echo $row->id....
#8

[eluser]mddd[/eluser]
Selecting * from multiple tables gives the risk of duplicate fields. I think that in such a case the last field of that name 'makes it'.
You need to find out which fields you REALLY need. If you need all fields of one table, and only some (like an id) of the others, it is better to do something like
Code:
SELECT users.*, user_occupation.name
This gives you all the fields of 'users' and only the 'name' field of user_occupation. If 'users' also has a 'name' field, use an alias:
Code:
SELECT users.*, user_occupation.name AS occupation_name
The same goes for id's, of course.


Messages In This Thread
getting data from db give wrong result when echo $row->id.... - by El Forum - 08-19-2010, 01:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB