HI
The below code is supposed to bring together multiple tables but for some reason its retuns repeat results for the query
based on my test data it should return DylanJennifer
but its returning DylanJenniferTylerJennifer
any ideas why
thank you
PHP Code:$query_get_Birthdays = ("SELECT * FROM users LEFT JOIN parent ON parent.owner_id = users.user_id LEFT JOIN children ON children.owner_id = users.user_id LEFT JOIN sibling ON sibling.owner_id = users.user_id WHERE month(childdob) = '3' OR month(spousedob) = '3' AND users.user_id = '$user_id' OR month(siblingdob) = '3' AND sibling.owner_id ='$user_id' OR month(parentdob) = '3' AND parent.owner_id = '$user_id'");
$get_birthdays = mysql_query($query_get_Birthdays) or die ("Invalid query". mysql_error());
while($birthdays = mysql_fetch_assoc($get_birthdays)){
echo $birthdays['childfirstname'];
echo $birthdays['spousefirstname'];
echo $birthdays['parentfirstname'];
echo $birthdays['siblingfirstname'];
}


Reply With Quote
Bookmarks