I'm trying to setup alerts for my profile page when there are either new profile comments, blog comments, or connections. Soooo, the alert works. When a comment on a profile is made my queries recognize a new addition and echo the appropriate variable. The problem that I've been having is that when I login again the second time around, my queries are seemingly still outputting that there is a new entry when there is not. Logically the second time I login as the same user the new alerts shouldn't show. Below in each query I compare the date of comment to the date of their last login (both of which are stored as datetime columns). Anyone have any ideas? Thanks
//login code here where I initiate session variables, etc.
//new profile comments?
$SQL= "SELECT usrcomments.MemberID, class_members.llogin, class_members.MemberID, usrcomments.dateadd FROM usrcomments, class_members where usrcomments.MemberID = class_members.MemberID and usrcomments.profid = '$a1[MemberID]'
AND usrcomments.dateadd < class_members.llogin";
if(mysql_num_rows(mysql_query($SQL))>0){
$message = "pcomments=true&";
}
//new blog comments?
$SQL2= "SELECT usrcomments.MemberID, usrcomments.oid, usrcomments.id, class_members.MemberID, class_members.llogin, usrcomments.dateadd, usrcomments.sect from usrcomments, class_members, blog where usrcomments.MemberID = class_members.MemberID AND usrcomments.sect = blog.id and usrcomments.oid = '$a1[MemberID]'
AND usrcomments.dateadd < class_members.llogin";
if(mysql_num_rows(mysql_query($SQL2))>0){
$message .= "bcomments=true&";
}
//pending connections?
$SQL3= "SELECT connections.usr, class_members.MemberID, connections.connection, connections.status, connections.dateadd, class_members.MemberID from connections, class_members where connections.usr = class_members.MemberID AND connections.connection = '$a1[MemberID]' AND connections.status = '0'
AND connections.dateadd < class_members.llogin";
if(mysql_num_rows(mysql_query($SQL3))>0){
$message .= "connections=true";
}
header("location:profile.php?id=$_SESSION[MemberID]&$message");
exit();