Don't do a SELECT *. Instead, list out the columns you want to select.
When you choose the ID columns, alias them.
SELECT tbl_job.id job_id,
A better option, if you have it, is to change your naming conventions in
your database. Instead of using ID for your primary key fields, have
TABLE_NAME_id instead. That eliminates this type of problem.
New here so sorry if this has been answered earlier, and I missed the
"Rick Emery" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Since you're matching on "id", why does it matter which table it came
> It came from both.
> Perhaps, I do not understand your question.
> -----Original Message-----
> From: Trevor Lanyon [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 27, 2001 1:13 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Accessing fields with the same name in MySQL
> select * from tbl_name, tbl_job where tbl_name.id = tbl_job.name_id;
> I use mysql_fetch_object to retrieve a row from the above result set. I
> have two objects, objName and objJob. The constructor for both objects
> accept a result object. How do I reference what table the "id" column
> from. These objects are generic so aliasing is not an option.
> So how to I differentiate what table each column comes from?
> Trevor Lanyon
> ClearOption Technologies
> 204.889.1906 - Office
> 204.831.7243 - Fax
> 204.229.2625 - Cellular
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]