doddsey_65 Posted March 22, 2011 Share Posted March 22, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/231371-query-not-quite-working/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.