Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP remember seen data

Featured Replies

Hello,

 

I was wondering if anyone had any idea what I should be searching for or if anyone knows of any tutorials to do the following Im currently tearing my hair out!

 

Ive made a website for someone where you submit your code which will then automatically go onto the front page of the site in order of date added. People can then see these codes and they can then enter each code into a game.

 

I have a mysql database with the following headings:

 

ID (Primary Key)

Code (The code a user submits)

Date (Date that the code was submitted).

 

I have it working fine that the code is submitted and goes into the database etc.

 

What I now need to do is set up an account option, where people can sign up and then if they have already added that code to the game, they can check a box next to the code and it wont show again.

 

Making the account is fine, but Im no expert with PHP and do not know how to go about setting up checking off whether the code has been seen by a user before or not.

 

I know I will have to make a new database for registered users, but for the already added codes bit, can you set up a new column on the database called added codes for example. Then each time a user checks off a code, it is put into this database, but all codes are put into one cell, rather than a database of 1000 columns against each user; one for each code checked off?

 

I hope this makes sense…if anyone has any ideas, please help!

 

Thanks in advance!

 

Mike

You'll need a seperate table we'll call it "used_codes" this is our link table to link users and the codes they've viewed.

 

The table will consist of:

 

used_code_id (unique id)

used_code_user_id (user id - this is the id of the user that used the code)

used_code_code_id (code_id - this is the id of the code used)

 

This table could become quite big but it's relatively simple. You will definitely want to add indexes on used_code_user_id and used_code_code_id to speed up queries.

 

Everytime a user ticks off a code we'll need to add this data to the table. You'll also need to lookup each code against this table to find out if it's been used by the user or not..

 

This is the fastest method for what you need to do.

Not that this is very relevant but I just wanted to congratulate Morgano on a really well explained solution. There is a lot of detail in there but you have explained it in such a way that even I can understand :)

 

Just thought it deserved a hearty 'well done' :D

  • Author

Thanks Morgano!

 

Now I know how to go about starting to set this up and that's all I needed, so thank you!

 

I will give this a go when I get back from work tonight.

 

Mike

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.