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
https://forums.phpfreaks.com/topic/231371-query-not-quite-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.