Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8789127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:18:57+00:00 2026-06-13T22:18:57+00:00

I recently thought that storing an array in MySQL database would solve my problems…

  • 0

I recently thought that storing an array in MySQL database would solve my problems… then I went and banged my head on a wall until I realised that there was an easier solution to my problem. Unfortunately I can’t seem to figure out what the hell I need to do.

I have two tables. User and Entry. Each user can be the Author of any number of entries. One to many right? Well the problem comes from the fact that each entry can have many users. -_-;

As you can imagine, doing this using arrays would be…not only cumbersome but also stupid, especially if someone managed to accumulate 2000 entries. I had anticipated that I might need to create an extra table and some resources do seem to suggest it but the resources aren’t as clear as I would have hoped. I will need to get all the users for a post and somewhere else, I’ll need to get all the posts for a user.

Can someone explain the best way of doing this? (Without using arrays of course =p)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:18:58+00:00Added an answer on June 13, 2026 at 10:18 pm

    you need to make 3 tables:

    • user (primary key = id)
      • id
      • name
      • …
    • entry (primary key = id)
      • id
      • text
      • …
    • userentry (primary key = complex key user,entry)
      • user
      • entry

    if you want to get an entrys users, just do

    SELECT
      user.*
    FROM
      userentry
    INNER JOIN
      user
    ON
      userentry.user = user.id
    WHERE
      userentry.entry = [your entry-id]
    

    and to get all entrys of a user, just do it the other way around:

    SELECT
      entry.*
    FROM
      userentry
    INNER JOIN
      entry
    ON
      userentry.entry = entry.id
    WHERE
      userentry.user = [your user-id]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently, I was studying about throwing our own exceptions and I thought that maybe
I have an applet, which I was writing in Java. Recently, I thought that
I've recently inherited an application that makes very heavy use of session, including storing
Until recently I thought limit on number of columns in Oracle DB was 255.
I have never thought about until recently, but I'm not sure why we call
I have recently started studying about threads. I thought of starting from the beginning
I recently came along this line of code: CustomData_em_free_block(&em->vdata, &eve->data); And I thought, isn't:
Recently We started on optimizing a database which never followed any standards. We though
Recently one of our app servers went down, when it was rebooted the Python
Just recently learned the correct application of inheritance of classes in Java and thought

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.