Welcome, Guest. Please login or register.

Author Topic: Sessions in PHP+MySQL (very confused!)  (Read 4756 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline countzero

  • Hero Member
  • *****
  • Join Date: Mar 2005
  • Posts: 1938
    • Show all replies
    • http://blog.coze.org
Re: Sessions in PHP+MySQL (very confused!)
« on: May 02, 2006, 02:03:40 PM »
Quote

motorollin wrote:

3. Unique session ID generated and stored both as cookie and also in the user's record in the "users" table of the database
4. Every time a page is loaded it retrieves the session ID from the cookie, then searches the users table and finds which user is associated with that session ID

moto


searching the db for session id for each page hit is not a good idea. I don't know how much server load you expect but this will probably choke the system. I suggest you keep them in a global array (which I believe PHP does internally). I tried to do something very similar a few years ago, but I guess I had some problem with the global session id array. (I can't remember at the moment)

ps : sorry for highjacking the thread
I believe in mt. Fuji