Hi all! Its been a while since I did PHP and MySQL and I've started practicing again. I've come upon an issue I'm not sure about. Here is my situation:
I've made a website with a login system and I've been able to get registration, email verification and loggin in working. Once I logged in I want users of my site to be able to store up to 20 strings in the database. By default I have a table with 21 columns with a row per each user. The first column is the user name and the other 20 are the data. By default they are NULL. I want to be able to make a script that can find which is the next NULL row and enter data into it. How can I do this? My users will be able to add and remove data from these rows, and they will not always necessarily be in order. For example:
Username | Data1 | Data2 | Data3 | Data4 | Data5 | Data6 |... etc
JohnDoe | 'foo' | 'bar' | NULL | 'abc' | '123' | NULL | ...
- Username | Data1 | Data2 | Data3 | Data4 | Data5 | Data6 |... etc
- JohnDoe | 'foo' | 'bar' | NULL | 'abc' | '123' | NULL | ...
In the above example, I'd like to be able to have a user save a string and have it stored in
Data3(since thats the first NULL value). When users no longer need the data it would be erased and returned to NULL, so there would be different places that are free for new data. How can I check for this?
Thanks in advance.