Note that there are some explanatory texts on larger screens.

plurals
  1. POProper way to build data structure for mySQL/PHP app that deals with a variable amount of quality specifications
    primarykey
    data
    text
    <p>Hello and thanks for taking the time to help me with my small conundrum.</p> <p>I'm trying to discern the best way to lay out the necessary tables and fields, as well as the best method of displaying/updating this information.</p> <p>I'm building a web app that deals in part with inventory levels across customer accounts. Customer can have a variety of products they hold in inventory, which also contain a set of quality specifications. While I presently have a short list of products that a customer may hold in inventory, that list will almost certainly grow. The list of quality specifications among these products will also certainly grow. Some quality specifications are shared between <em>all</em> products, such as "weight". Others are unique to a specific product. Most are measured in a numerical value, however some are simply strings of text (however depending on the product, that text is a set value string.) These items would finally contain a price per unit, and whether or not they were for sale at that time.</p> <p>So far we know we have:</p> <p><strong>List of products</strong> - Each product will have a unique description among other small properties.<br> <strong>Quantity of said product</strong> - Measured in metric tonnes.<br> <strong>Quality Specifications</strong> - Some shared between all products, others unique to a single product.<br> <strong>Product Price</strong> - and whether they are presently for sale or not. </p> <p>My intended execution:</p> <p><strong>Table of customers</strong> - Pretty standard stuff, who they are bla bla<br> <strong>Table of product types</strong> - containing the descriptions as well as weight conversions properties.<br> <strong>Table of quality specifications</strong> - This table would contain all of the possible quality specifications.<br> <strong>Table of inventory</strong> - containing quantity of product as well as desired pricing, and if they are for sale or not.</p> <p>My intention was to JOIN the quality specification table to the inventory table, then JOIN the inventory table to both the customers and product types tables. To display the quality specifications, a FOREACH loop with key=>value pairs to display the name of the quality specification (field name) and it's value. Any field that was NULL, the loop could ignore, thereby removing quality specifications from products that don't need them.</p> <p>I know this isn't the best approach. I'll need to be able to update the quality specifications to each item as they change on a per-customer-inventory basis, as well as introduce new products and perhaps new quality specifications down the line, ideally through the app, however it's something that isn't so frequent that it would be a problem to simply update the tables manually. I'm guessing it would happen a few times a year, if even.</p> <p>I could most certainly use any help or insight anyone with a bit more experience might be able to provide. I just feel like I'm not seeing this in the right way of doing it.</p> <p>Many thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload