Jump to content

jj.amonit

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jj.amonit's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I was wondering if anyone has the answer or can point me to a topic with the answer for this problem I have. Let's say my users take inventory of grocery stores. And for this example, every grocery store has the same three products (apples, watermelons, and plums). But when it comes to oranges, they may have up to three different types of oranges. Each time the user goes to take inventory, they count all of them up and enter them in. In order to accomodate all the inventory, I created a database that has two tables. Table A records the three constants: apples, watermelons, and plums. It stores the date of inventory, and the number of fresh and bruised of each fruit. I then use the index for that day's inventory and enter it into Table B for each variety of oranges for that store. For example, let's say the grocery store has two varieties of oranges. So, for every date of inventory, two rows are created in Table B, one for each variety. Each row contains the index from Table A and the number of fresh oranges and the number of bruised oranges for that variety. Now, once the inventory is finished, I want to display the data for the user. So, I create a table to show it. I want it to look like this. Food | Date 01/01/2009 apples fresh 6 apples bruised 8 watermelon fresh 10 watermelon bruised 12 Plums fresh 15 Plums bruised 10 Orange 1 fresh 5 Orange 1 bruised 7 Orange 2 fresh 10 Orange 2 bruised 15 To add to the complexity, this is an accumulative project. As more inventories are taken, a new column is added to the right of the previous date. Okay, so here is my results so far. I can get the fixed "table a" to display properly. I query the db for each row I want to display. It's probably terrible code, but it works. However, when I get to displaying the data from 'table b', I begin to have problems. I can get the data to show up properly for Orange1. But if that works, I can't get Orange2 to show up. I'm new to php programming, and just don't know what functions to use. I tried while, foreach, etc. It may seem simple to experts, but I am just at a loss. And I don't have a mentor to ask for help. So, did I design my database improperly? Am I just missing something is my search for code? I will be happy to answer any questions, if I didn't explain myself clearly enough. Thanks
×
×
  • 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.