Jump to content

Query not quite working


doddsey_65

Recommended Posts

Im using the following query to pull all topics that have a new reply since the users last visit and where the user has posted within them.

 

$topic_query = $link->query("SELECT t.*, u.*, p.*
            FROM ".TBL_PREFIX."topics as t
            LEFT JOIN ".TBL_PREFIX."users as u
            ON (u.u_username = t.t_poster)
            LEFT JOIN ".TBL_PREFIX."posts as p
            ON (t.t_tid = p.p_tid)
            WHERE t.t_last_post_time > u.u_activity_time
            AND p.p_poster = '".$user->user_name."'
            GROUP BY t.t_tid
            ORDER BY t.t_sticky DESC, t.t_time_posted DESC
            LIMIT $start_page, $topics_to_show")
            or die(print_link_error());

 

for some reason though it still shows two topics that have a last post time which is less than that of the users activity time.

 

The last_post_time for the topic is

 

1300309160

 

compare that with the users last activity time

 

1300784679

 

as you can see the last activity time is more than the last post time. there are no records in the database that are more than the last activity time so i shouldnt be getting any results.

 

Anyone have any ideas?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.