mapleleaf Posted December 9, 2008 Share Posted December 9, 2008 I have two tables which have a column for email. The emails are not the same. <?php $mailquery = "SELECT subscribers.name, subscribers.email, business_contact.first_name, business_contact.last_name, business_contact.email FROM subscribers, business_contact WHERE subscribers.primary_id = '8' AND business_contact.id = '8'"; $mailresult = mysql_query($mailquery) or die(mysql_error()); $mailrow = mysql_fetch_array($mailresult); ?> I also follow this with a while doing the same. The first time round I only want the businees email and in the while i want all the subscribers email. Business email is always only one. Subscribers could be many. $mailrow['subscribers.email'] doesn't seem to work so how to differentiate? TX Link to comment https://forums.phpfreaks.com/topic/136226-solved-getting-rows-from-different-tables-with-the-same-column-name/ Share on other sites More sharing options...
mapleleaf Posted December 9, 2008 Author Share Posted December 9, 2008 use alias "SELECT subscribers.email as SB_Email" to differentiate. Link to comment https://forums.phpfreaks.com/topic/136226-solved-getting-rows-from-different-tables-with-the-same-column-name/#findComment-710638 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.