make available to the session?

Discussion in 'PHP' started by devo10, Jun 30, 2010.

  1. #1
    Hello people

    I have created a Userid for my site so that when the user registers they can change their username and other details, and the system will always remember their userid.

    At the moment I have made my system to ‘auto-increment’ the userid in the mysql database, so that each new user is assigned a ‘permanent’ userid.

    I want to make this userid available to the session so that when the user users some features of my site, their userid is logged along with their comments, for example.

    How can I get this userid to be stored inside the session?

    Any help would be appreciated.

    Many thanks
     
    devo10, Jun 30, 2010 IP
  2. jam4517549

    jam4517549 Member

    Messages:
    58
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #2
    registration:
    validate and insert data to database table
    if you want to register the userID on session, just after registration, you can get that userID using the "mysyl_insert_id()"
    that returns the newly inserted ID

    Login:
    validate and user and password
    include userid in your query select userID, username, password from members where username = $username ...
    then include userID to your session..
     
    jam4517549, Jul 1, 2010 IP