$query2Count = 0;
$query = "SELECT id, fname, lname FROM contacts ORDER BY lname ASC";
$results = mysql_query ($query) or die(mysql_error());
while( $row = mysql_fetch_array ( $results )){
$contactId = $row['id'];
$contactFname = $row['fname'];
$contactLname = $row['lname'];
$query2 = "SELECT groupID FROM contactgroups WHERE contactID = $contactId";
$results2 = mysql_query ($query2) or die(mysql_error());
while( $rows = mysql_fetch_array($results2)){
if (mysql_num_rows($results2) == 0){
$query2Count = $query2Count + 1;
echo $contactId;
echo " - ";
echo $contactFname;
echo " - ";
echo $contactLname;
echo "<br>";
}
}
}
echo "Total matches for secondary query is :";
echo $query2Count;
I am trying to find ids from the first table that are not present in the second table of which there at least 4000 yet nothing is found.
Any help would be appreciated.