Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Sharing session variables?

Question posted by: Gilles Ganault (Guest) on March 12th, 2008 10:45 PM
Hi

A friend of mine use PHP sessions to keep track of user data on the
server. The problem is that some of the SELECT queries are common to
all users, but apparently, session data cannot be shared among users.

Is there a way to share the output of a SELECT?

Thank you.
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
ZeldorBlat's Avatar
ZeldorBlat
Guest
n/a Posts
March 12th, 2008
10:55 PM
#2

Re: Sharing session variables?
On Mar 12, 6:41 pm, Gilles Ganault <nos...@nospam.comwrote:
Quote:
Originally Posted by
Hi
>
A friend of mine use PHP sessions to keep track of user data on the
server. The problem is that some of the SELECT queries are common to
all users, but apparently, session data cannot be shared among users.
>
Is there a way to share the output of a SELECT?
>
Thank you.


Session data typically can't be shared between users -- that's one of
the reasons they're very effective.

Just store the result somewhere else. You can serialize it and write
it to a file or use something like memcached. Then you just check if
the result you're looking for is in the cache. If it is you use it;
if it isn't you hit the database then store the result.

Gilles Ganault's Avatar
Gilles Ganault
Guest
n/a Posts
March 12th, 2008
11:05 PM
#3

Re: Sharing session variables?
On Wed, 12 Mar 2008 15:47:37 -0700 (PDT), ZeldorBlat
<zeldorblat@gmail.comwrote:
Quote:
Originally Posted by
>Just store the result somewhere else. You can serialize it and write
>it to a file or use something like memcached.


I'll read up on serializing data, or using a Memcached daemon. Thanks.

 
Not the answer you were looking for? Post your question . . .
182,256 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors