Sigh....nope...
copied your script exactly, but it still doesn't delete a user name which isn't in the member db.
I really thought moving the end of the for loop would do the trick...
I thought this little script would be trivial!! HA, was I wrong...
//search the member database for all names
$result=mysql_query("SELECT * FROM tbl WHERE M='$m' ");
WHILE ($a = mysql_fetch_array($result)) {
$member[] = $a['name'];
}//close while
//search the user database for all names
$result2 = mysql_query (SELECT * FROM tbl WHERE T = '$t' ");
WHILE ($b = mysql_fetch_array($result2)) {
$user = $b['name'];
$flag = 0;
//take the first username found in the WHILE loop and enter the FOR loop. Let the FOR loop check that first username against all the member names. If a match is found set the flag to 1 (and exit).
for ($i=0; $i<=count($member); $i++) {
if ($user == $member[$i] ) $flag= 1;
// If the flag is still set to 0, no matching name was found and the username should be deleted.
if $flag=0 {
mysql_query ("DELETE FROM tbl WHERE Name = '$user'")
}
}//end for
}//end while