Jump to content

AdamScoville

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

About AdamScoville

  • Birthday 04/09/1990

Contact Methods

  • Website URL
    http://www.startinggrounds.com

Profile Information

  • Gender
    Male
  • Location
    Canada

AdamScoville's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Finally found a community I could join for programming. Look forward to learning and perhaps helping in the future with PHP / MySQL. And I already have a post in PHP Coding for all you great programmers to help me with.
  2. Hello everybody, I'm very excited to find a community towards programming. I've been doing web development for about 5 years now, and I'm starting to get down some serious projects, one of which I need help with right now. Over at: http://www.startinggrounds.com/forums.php Problem: In forums.php I have this: if($count >= 1) { while($post_ind = mysql_fetch_array($check)) { mysql_query("INSERT INTO thread_indicators (ForumID, ThreadID, UserID) VALUES('$forum[ForumID]', '$post_ind[ThreadID]', '$logged[MemberID]')"); } echo $new; } else { $count = mysql_num_rows(mysql_query("SELECT ind_id FROM thread_indicators WHERE ForumID=$forum[ForumID] AND UserID=$logged[MemberID]")); if($count >= 1) { echo $new; } else { echo $old; } } This is used to check for new posts. On viewforum.php I have: <?php if(!$logged['Username']) { $history = time()-(60*60*24*7); echo ($row['LastPostDate'] >= $history) ? $new : $old; } else { $check = mysql_num_rows(mysql_query("SELECT `ind_id` FROM `thread_indicators` WHERE ThreadID='$row[ThreadID]' AND UserID='$logged[MemberID]'")); if(!$check && ($row['LastPostDate'] >= $_SESSION['sglastvisit'])) { mysql_query("INSERT INTO thread_indicators(ForumID, ThreadID, UserID) VALUES('$_SESSION[sgforum]', '$row[ThreadID]', '$logged[MemberID]')"); echo $new; } elseif($check) { echo $new; } else { echo $old; } } ?> Continued to show where the new posts are. And they indicate properly. Here is the problem. When you view the thread it removes the record for the new post stored in "thread_indicators" in the MySQL DB as it should, but when you go back to the forum homepage it's showing the post as new again. Here is my header: if($logged['Username']) { $time = time(); $getlast = mysql_fetch_array(mysql_query("SELECT LastVisit FROM members WHERE MemberID='$logged[MemberID]'")); $lastvisit = $getlast['LastVisit']; $_SESSION['sglastvisit'] = $lastvisit; mysql_query("UPDATE members SET Online='$time', LastVisit='$time' WHERE UserID='$logged[MemberID]'"); } And viewthread.php coding for the deletion: $timeread = time(); /*** Declare Post Read */ @mysql_query("DELETE FROM `thread_indicators` WHERE ThreadID='$threadid' AND UserID='$logged[MemberID]'"); @mysql_query("OPTIMIZE TABLE thread_indicators"); Can anyone solve this problem or help me with a more appropriate method of doing so? Thank you for your time to read my huge post and help me!
×
×
  • 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.