WEB User specific content using PHP and MySQL

Discussion in 'OT Technology' started by Guld, Aug 5, 2009.

  1. Guld

    Guld 昇龍拳

    Joined:
    Jun 18, 2004
    Messages:
    10,770
    Likes Received:
    0
    Location:
    Ontario, Canada
    How would I go about creating user specific content using PHP and MySQL? I know how to make tables and request info from them and stuff like that so my question is really more geared toward how to structure the data to deliver it. I know how to generate a user database to have users log in, but how would I go about granting and saving user content for them to log into to access/edit? How would I have pages unique to the user as opposed to the log in just granting generic access to the site? Any help would be great.
     
  2. pharmokan

    pharmokan OT Supporter

    Joined:
    Oct 18, 2002
    Messages:
    102,125
    Likes Received:
    418
    Location:
    L.A.
  3. Guld

    Guld 昇龍拳

    Joined:
    Jun 18, 2004
    Messages:
    10,770
    Likes Received:
    0
    Location:
    Ontario, Canada
    :rofl:

    Well, lets say I wanted users to be able to log in to their account and input information through a form (list of book titles, list of phone numbers, etc.) have that write to a database then have the appropriate info display for the appropriate user on the appropriate page. Jim would be able to log in, go the the phone numbers page and see a list of phone numbers specific to his account on that page, while Larry would log in, go to the phone numbers page and see a different list specific to his account.
     
  4. pharmokan

    pharmokan OT Supporter

    Joined:
    Oct 18, 2002
    Messages:
    102,125
    Likes Received:
    418
    Location:
    L.A.
    ah i see

    so you would use multiple tables for that shit and join them

    best way to go around doing that is:
    when someone signs up, assign a userID int to their login information
    ___________________________________
    |user id | email/login | password |
    =====+=========== +=======|
    | 13 | [email protected] | asdfasdf12 |
    ------------------------------------------------

    then use that universal userID in all the tables of their personal info

    and when it comes time to pulling up their shit u reference that person by their universal userID through a php getUserId method
     
  5. Guld

    Guld 昇龍拳

    Joined:
    Jun 18, 2004
    Messages:
    10,770
    Likes Received:
    0
    Location:
    Ontario, Canada
    This is the part I'm unsure about. I've already managed the user table with UserID, email, password, etc. So after that each user would have another table assigned by their UserID?
     
  6. pharmokan

    pharmokan OT Supporter

    Joined:
    Oct 18, 2002
    Messages:
    102,125
    Likes Received:
    418
    Location:
    L.A.
    1 access table

    has info for all people's login information passwords and corresponding userID's

    1 personal contacts table

    has info for particular userID, going down the rows full of peoples contacts information corresponding to their userID


    example: table personal contacts for userID=13;
    ________________________________________________________________________
    | contacts ID | contacts email | contacts name | contacts phone number |
    ----------------+---------------------------+----------------------+----------------------------|
    1 | [email protected] | nagger | 1310-455-1239 |
     
    Last edited: Aug 5, 2009
  7. Guld

    Guld 昇龍拳

    Joined:
    Jun 18, 2004
    Messages:
    10,770
    Likes Received:
    0
    Location:
    Ontario, Canada
    Ok, that makes sense. How would I link the UserID to the new table though?
     
  8. pharmokan

    pharmokan OT Supporter

    Joined:
    Oct 18, 2002
    Messages:
    102,125
    Likes Received:
    418
    Location:
    L.A.
    in php script:

    var $userID=getUserID()

    this->getPersonalContacts($userID)



    ===================

    function getPersonalContacts(user-id) {

    connect to db.

    send statement to db: select * from table personalcontacts-[user-id]
    write to html table full of contacts.

    }


    so in essence SQL statement select * from table personalcontacts-13

    retrieves all personal contacts from userID # 13
     
    Last edited: Aug 5, 2009
  9. pharmokan

    pharmokan OT Supporter

    Joined:
    Oct 18, 2002
    Messages:
    102,125
    Likes Received:
    418
    Location:
    L.A.
    this is content management. you're setting up static statements + dynamic variables to retrieve information for a particular user with a particular userID.
     
  10. Guld

    Guld 昇龍拳

    Joined:
    Jun 18, 2004
    Messages:
    10,770
    Likes Received:
    0
    Location:
    Ontario, Canada
    Ok. Thanks for the help. I'm going to mess around with this for a bit.
     

Share This Page