You could try returning the whole info with an alias
i.e.
select tbl_job.id AS jobno, tbl_job.name.id, tbl_job.job, tbl_name.* from
tbl_name, tbl_job where tbl_name.id = tbl_job.name_id;
You should then be able to refer to the tbl_job.id as jobno in any $row
function
i.e.
$jobnum=$row['jobno'];
Haven't tried it, but I "think" it would work.
good luck
Howard
-----Original Message-----
From: Trevor Lanyon [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 28 August 2001 4:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Accessing fields with the same name in MySQL
tbl_job
-------
id
name_id
job
tbl_name
--------
id
first
last
SQL
---
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 came
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
http://www.clearoption.com
--
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]