SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    And your point is.... redgoals's Avatar
    Join Date
    Feb 2002
    Location
    Birmingham, UK
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    which is better? faster?

    im going to track recently viewed pages by a user visiting my site, now the information will include the article title and the id of the article.

    should i store only the id and grab the title from the mysql table or just store the title and id in the session array?
    http://redgoals.com ... my site ... nuff said

  2. #2
    SitePoint Wizard Mike Borozdin's Avatar
    Join Date
    Oct 2002
    Location
    Edinburgh, UK
    Posts
    1,743
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I think session storing is a right idea. Because you won't have to exucute unwanted queries.

  3. #3
    And your point is.... redgoals's Avatar
    Join Date
    Feb 2002
    Location
    Birmingham, UK
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i agree also, now im trying to display the recently visited articles and have hit a problem

    what im trying to do is when the user visits a page i add the id and title of that page on to the end of the session array...

    $history[] = $cat."/".$id;

    then i would reverse the array so the last page they visited is the first index in the array...

    $history = array_reverse($history);

    then i would get the unique values from the array (i.e. removing pages which have been visited more than once)...

    $history = array_values(array_unique($history));

    then i would splice the array to the last 5 pages viewed...

    $history = array_splice($history, 0,5);

    now all that does not give the desired result, im getting mixed results..check it out here www.redgoals.com/index/news visit a few articles and watch the in the right menu the article you recently visited.

    the article you last visited should be first in the list;but it wont. (make sure you visit at least 10 DIFFERENT articles to see what im talking about)
    Last edited by redgoals; Feb 2, 2003 at 09:07.
    http://redgoals.com ... my site ... nuff said


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •