This is a discussion on ""since your last visit" quandary" within the PHP Forum section. This forum, and the thread ""since your last visit" quandary are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
"since your last visit" quandary
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
"since your last visit" quandary
Application is a simple message board. Each time the user returns I want to show a message stating the number of new posts since the last visit. But here's the catch - I want to retain that information for the user's entire session, only updating the "LastPost" datum at the end of the session.
Now, Determining which posts are new and storing the "LastPost" datum isn't the issue. That stuff I can handle. What I can't figure out is how to allow the user to continually refer back to the page that shows him the new posts since his last visit. Since the page is query driven and uses the "LastPost" datum as the filter criteria, I can't update the "LastPost" datum until I know the user is done with his session - - if I do, the query-driven page will show different data. To put it another way, pseudocode would look something like this...
Last edited by Lchad; May 22nd, 2007 at 11:27. Reason: added code tags for ya! |
|
|
|
|||
|
Re: "since your last visit" quandary
If you're using $_SESSION, why not store the "lastpost" data in there when a user starts a new session and refer back to that variable throughout the session, rather than going back to tha database each time?
|
|
|||
|
Re: "since your last visit" quandary
I guess I'm a bit skittish wrt session vars. I only recently learned about them/how to use them and began using them, but I ran into so many problems... the sid would change when I posted a form, etc. Maybe I'm doing something wrong, I don't know. (Or maybe it's a Xampp issue and I won't have those problems once the pages are published.)
Your suggestion seems like the logical way to go about it, though. I'll give it a shot and see how it goes. Thanks, Graham. |
![]() |
| Tags |
| last visit, recent posts |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Creating a "tag" system to find relevant "related" pages | MrQuestions | PHP Forum | 3 | Mar 20th, 2008 23:06 |
| [SOLVED] Show "Image" Depends On User "Status"? | Monie | Classic ASP | 6 | Oct 16th, 2007 01:22 |
| ? IS "meta name="robots" content="?" necessary in pages ? | Love2Java | Starting Out | 6 | Aug 8th, 2007 13:48 |
| window.opener.document["nameForm"].getElementById("someid").value; doesnt work | drpompeii | JavaScript Forum | 0 | Feb 17th, 2007 23:09 |
| <option value="yes" class="x"> problem in Firefox | mameha1977 | Web Page Design | 1 | Jun 21st, 2006 11:20 |