RE: [PHP-DB] Accessing fields with the same name in MySQL

From: Date: Tue, 28 Aug 2001 06:57:54 +0000
Subject: RE: [PHP-DB] Accessing fields with the same name in MySQL
Groups: php.db 
Request: Send a blank email to php-db+get-11880@lists.php.net to get a copy of this message
You have two times the field "id" .... Look at your query ... especially the Where-Clause .. You only want to show Recordsets where id = id ... => In both columns is the same value ... > -----Original Message----- > From: Trevor Lanyon [SMTP:trevor@clearoption.com] > Sent: Monday, August 27, 2001 20:13 > To: php-db@lists.php.net > 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: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender.

« previous php.db (#11880) next »