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 6089057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:03:23+00:00 2026-05-23T12:03:23+00:00

I’m trying to figure out my first more complex SQL application and am having

  • 0

I’m trying to figure out my first “more complex” SQL application and am having a bit of a hard time conceptualizing the best way to go about something simple. I understand the code, I think, around various concepts but want to know the best way you think is the way to proceed, and more importantly what terms/how to call this method, so I can do more research on it myself without needlessly bothering people!

I am building a WP plugin that will let someone add any number of boxes to any number of “transactions”. Basically, transaction 1 can have box 3 boxes called apples, fruits, organes. Transaction 2 can have 10 boxes. And so on. I want a way to show this to the end user in the best way. As a beginner, my (bad, I’m sure) instinct is to have one key called, say, transactions, which is a comma separated list “1,2,3,4,5”. Then, have another table where the index is 1,2,3 and for each of these keys i have the various boxes. I grab the first CSV list from the db, “explode” it to an array and cycle through, grabbing the keys from the second table that reflect this #. But in the second table, does each “key” point to other keys? This is where i get confused. Is this the best way to proceed? What kind of code would I need to look for? EDIT: Here is a visual image of what I’m looking for:

Transaction 1: #12878321: Apples, Oranges, Pears
Transaction 2: #11239089: Berries, Oranges, Apples
Transaction 3: #89792834: Spaghetti, Berries, Oranges, Pears, Apples

I would like to display on the page the information just like that. So I need to store the transaction number, the random code, AND “what was purchased” (the boxes in my example above) all to the end user.

I’ve already done inserts, updates, etc on one table but never connected (correct word?) two tables and don’t know if thats the way to do it, to create another WP table.

I apologize if this is a strange and long question, but among the 1,000 of tutorials on the web, its hard to understand which one to follow because I’m not familiar with the terms themselves!

  • 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-05-23T12:03:24+00:00Added an answer on May 23, 2026 at 12:03 pm

    What you want is (I think) called a “many to many” relationship. These are usually best handled by an association table; the association table simply has two (relevant) columns; the ID of a record in one table, and the ID of a record in a second table. That way, you can create a SQL statement that will find for you all of the “boxes” (records in table 2) that exist for a given “transaction” (records in table 1); you can also create a query that will allow you to find all of the “transactions” (records in table 1) that refer to a given “box” records in table 2.

    For this, you need three tables:

    Transactions
    ID,   Whatever else you keep for transactions
    
    Boxes
    ID,   Contents
    
    TransactionBoxes
    TransactionID,   BoxID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.