/    Sign up×
Community /Pin to ProfileBookmark

Using LEFT JOIN with out good results

Hello all!

I’m using LEFT JOIN on a query of mine where I would like to be able to display a BOLD title of a thread in a forum if the user that is logged in has not read the last response to the thread.

Right now, I have this code:

[code=php]
$query = “select * from forums_threads as t1
left join forums_readlist as t2 on t2.threadID=t1.id
where t2.userID = ‘$n[id]’
order by t1.lastpost desc
LIMIT $start_from,10”
[/code]

This code just brings me back every row in the “forums_readlist” but not rows from the “forums_threads” … I’m wondering if I need to configure the table in MySQL in a different way? Do I have to do some kind of “joins” there also to make this work?

Hoping for some help ?

Magnus,
Iceland

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @trymbill 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,
)...