SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to better retrieve user object

    This question must be asked a lot, but I still couldn't find anything good. I have a lot of php pages that need to use the user object. What I am wondering is what would be a better way to handle this:

    1. Make a global user object once logged in, and re-retrieve it only when it is updated, or
    2. Create a new local user object for every page if logged in, and go from there.

    Obviously the first one will make less queries to the database, but I am still wondering how others handle this. Maybe there's another option. Any ideas?

    Thanks.

  2. #2
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, depending on the quantity of information that is needed from page to page, you could always store the info in session variables. Or heck, even a cookie. But again, that is all dependent on the type and quantity of information.

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm, i haven't thought of that. that might work pretty well. the way i have it setup right now is the second option. i am just worried about crashing mysql server or executing more queries when one would do. thanks.


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
  •