Jump to content

MySQL Array Solution?


davidmyers

Recommended Posts

I am currently working on a project with PHP and MySQL. Some of the requirements are that I have a user/login system, a messaging system, a calendar, and projects that the users are part of and that show up on the calendar. I am trying to find a solution to store the information for the projects and the people involved with them.

 

I have a table for users and am planning on a table for projects. I initially thought about just having a column in the projects table that would be of type array. The array would hole users associated with the project in that row. I realized however that arrays aren't a column type. I've tried thinking of many different ways to solve this, but I always run in to the same problem. I have no way of knowing how many different users will be part of any project or how many different projects any one user will be a part of.

 

I don't know if there's a way to accomplish what I want through complicated logic or if there's some way to do it using MySQL. I'm sure that there is some way to do this though.

Link to comment
Share on other sites

I just had an idea but am not sure if it would work.

 

Say I have a column of type fulltext in my projects table. I could add a name into that cell with some sort of termination character at the end of it. Such as this: "John Doe;" The first question is could I write PHP code that would know to extract separate names by looking for the termination character (semi-colon in this example). The next question would be can I append information to that cell later, such as adding another name to the fulltext cell? Such as this: "John Doe; Jane Doe;"

 

This may not work or may just be a poor way of solving this problem. Let me know what you think.

Link to comment
Share on other sites

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.