Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7895153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:34:25+00:00 2026-06-03T07:34:25+00:00

This is a followup to a question I posted a few days ago. basically,

  • 0

This is a followup to a question I posted a few days ago.

basically, I have a site with six links. In order to access the site, users must log in using LDAP authentication. When they do this, I grab some of their account credentials (username, firstname, lastname), and store it in a PHP $_SESSION variable.

That works; the user can log in, and the session data is being stored successfully.

Now, I want to set up a way to track which links have been clicked by what users. Basically just store a time stamp in the database of when they clicked the link. I want to be able to see who has (or has not) clicked each link, and when.

Can I do this in a single table / would that be a bad idea? I was thinking setting up the table like this:

TABLE (each bullet indicative of a column)

  • auto-incrementing ID
  • user account name: abc1234
  • user account first name: John
  • link 1: Last Accessed 5/2/2012 at 4:15PM
  • link 2: NULL
  • link 3: NULL
  • link 4: Last Accessed 5/1/2012 at 2:20PM
  • link 5: NULL
  • link 6: NULL

basically the above would say that “John” had only clicked the first and 4th links. The rest are null because he has never accessed them. If he were to click #1 again, it would overwrite with the more recent date/time.

Can I do this in a single table? or will that create complications? I feel like the thing I will have the hardest time with is checking to see if the user is already in the database before adding the info (ie so that if John logs in a second time, a whole new row isn’t created for him)

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:34:27+00:00Added an answer on June 3, 2026 at 7:34 am

    That would be a bad idea. What if you wanted to have a seventh link? What if the user format would change?

    This solution requires 3 tables:

    • Users – contains user data (And a user ID).
    • Links – contains link data (And a link ID).
    • Clicks – many-to-many relationship between users and links.

    That third table would look like this:

    user_id | link_id | timestamp
    -----------------------------
    1       | 2       | ...
    2       | 2       | ...
    1       | 3       | ...
    ............
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I posted this question a few days ago, and I have some follow up
This is a followup to a question I posted yesterday. I thought everything was
NOTE: This is a followup to my question here. I have a program that
This is a followup question to the one I posted last week Ajax.ActionLink not
This is a followup/post question to another question; as I have discovered a solution
This is a follow-up question to an answer I gave a few days back
This is a followup question to: SQL Query with ORDER BY But I think
I have a followup question to this question . I'm writing a web service
I have a similar situation to this question , which was already posted. Koraktor
My question is basically is a followup question to this one , I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.