I'm working with MariaDB through PHPMyAdmin and I have a question about how I need to set up my database. For eash person in the table I am currently building I'll also need an array of date values. I don't think there is a way for me to setup a table in this fassion.
-> fName, lName, ID, arrayOfDateValues. I will also not know exactly how many date values may be needed, sometimes an entry may only need 1, other times and entry may have 4+. I'm assuming I'll need to create a sepearte table and just make sure that I create enough rows for all the possible dates I may need. Could someone shed a llittle light on this for me please? Thanks.

Also, does anyone know how to create a key table PHPMyAdmin so I'll be able to link up the date(s) with the correcty entries? Thanks again.

Recommended Answers

All 3 Replies

Member Avatar for diafol

You'll need 2 tables:

users: fName, lName, ID with ID as Primary key
userdates: ID, date where both fields make the primary key

You need to make ID in userdates as a foreign key (constraint)

Use joins to get ALL dates for a user. You could also use GROUP_CONCAT to get something similar to what you want with the one table.

The ID's in this case are 8 digit numbers that will not follow any discernible progression. Shouldn't I create another column as primary key and have it set to auto increment? I'm not good with databases so I'm just guessing. Also, how are these things done in PHPMyAdmin? Thanks again.

Member Avatar for diafol

Pk doen't have to be autoincrement. If you are supplying ID for every user you create and they are unique. Fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.