/    Sign up×
Community /Pin to ProfileBookmark

left Join problem

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

[code=php]
$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’];
}
[/code]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @kproc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...