I have a table of objects (I'll call it "obj") and I want to search for objects matching a particular where clause and which are linked to users, and then get those objects and users, so:
Code: Select all
"SELECT users.*,obj.* FROM users, obj WHERE obj.userid=users.id AND [other conditions]"-I can't use mysql_fetch_assoc because field names may overlap, especially the field id, which is guaranteed to overlap for any two tables.
-I don't want to hard-code the number of fields that each table has, because this may change and that seems like a hacked way to separate the returned values.
It looks like my answer is to use mysql_field_table to determine the table for each field, but my instincts with my past attempts to build something like this in PHP is that I'm overlooking or don't know about something simpler I can do. This seems like a fairly common application, so, is there an easy way to do this, or am I just going to have to build it myself?