Jump to content

Recommended Posts

I am making a site and in the database there is a table which has a list of links and their respective description, category, etc.  On the site, the list is printed into an HTML table which can be sorted, etc. by the user.  The only thing I can't get though is that when a person clicks on the link, I want the link to not show up again the next time the HTML table is rendered.  Is there an easy way to do this?  Any responses would be greatly appreciated.

Thanks in advance,

Michael

Link to comment
https://forums.phpfreaks.com/topic/89495-question-involving-tables-and-links/
Share on other sites

You have to save the fact that the person clicked on the link. You can save it as a cookie, a session variable, a get variable, or in the database. Whichever you choose is up to you. Then, you can use that variable a few ways - you can set your database queries to have the condition that whatever you are using to qualify your links doesn't equal the variables you have saved, or you can pull everything out of the database, and before each link is printed out, it checks itself against the list of links that have already been clicked. The second option isn't very efficient though, and you would be better off tailoring your database query to only pull the information you need out of the database.

Thanks for the response.  There will be many (75-100 variable) links in the table at a time.  What I have come up with so far: after the user clicks on a link, they click a button to signify they clicked on the link, which then adds to another table, an id, the user's user id, and the link id of the one they clicked.  Is there a way I can use that data to tailor the request to the database to call the links?  I am sorry if I am missing something that is really easy, I just have been working on this far too long and I am thinking way too much.

Thanks again,

Michael

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.