1

I am having trouble understanding how I should structure my database tables. I want users to be able to upload a name (just the first name) of someone they know. The names they upload get stored in a table called people (with an auto-incrementing primary key). I then want, on a separate page, the names the user uploaded to be displayed. On this page, users can create a list. For example, 'white people'. Then I want users to be able to create another list(s) using the names from the list 'white people'. It could break down like this:

People> Matt, Adam, Alex, Aaron, David, Whites> Matt, Adam, Aaron, Friends> Matt, Adam, Enemies> Aaron,

I am absolutely perplexed as to how I should approach this. Can arrays be stored in a column in a database? Is that good practice/functional? How many tables am I going to need? Please any advice will help me. I am no beginner with PHP.

1 Answer 1

4

Storing array in table will not be good approach. Will be difficult to manage (update,fetch) and search data.

I think 2 tables are good:

1) people :

user_id | namw

2) lists :

id | user_id |joined_user_name | relation (friend/enemy)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.