PDA

View Full Version : Combining Info From 2 Tables...



tomyknoker
04-15-2007, 01:00 PM
I am trying to combine info from 2 tables, I have managed to output rep_Firstname & rep_Lastname, in the output but since I did this I have now lost all the other info from 'tblmembers'... Any ideas?


$results = mysql_query("SELECT tblrepresentatives.rep_Firstname,tblrepresentatives.rep_Lastname FROM tblmembers LEFT JOIN tblrepresentatives ON tblmembers.rep_NBR = tblrepresentatives.rep_NBR WHERE tblmembers.memberApproved = 'P'");


if (mysql_num_rows($results) < 1) {
die('No members were approved last month');
}

else {

while ($qry = mysql_fetch_array($results)) {
if (strtotime($qry['loginDateTime']) <= (time() + 86400*31)) {
$login .= 'Name: '.$qry["FirstName"].' '.$qry["LastName"].' ('.date("d/m/Y", strtotime($qry["JoinDate"])).') '.$qry["Email"].' '.$qry["rep_Firstname"].' '.$qry["rep_Lastname"].' ('.$qry["State"].')
';
}
}