From database to HTML table

Hi guys,
I have a problem displaying some database data in an HTML table.
The records in the database are in the following format (color, size, price): ex.

  1. Black S 10.98
  2. Black M 11.23
  3. Black L 12.12
  4. Red M 11.23
  5. Red XL 13.19
  6. Blue L 13.00

    And now I should print it in the table in the following format as in the picture.

Screenshot_1

Thanks.

Are you saying all the data for a product is in a single DB column? If so, that is your REAL problem. Learn about Database Normalization and fix your DB.

No, those are three colums (there is much more of them but i need only those three).
color_name: ex. Black
label_size: ex. XL
price: ex. 10.77

I recommend indexing/pivoting the data, using the color and size as the array indexes, when you retrieve the data, so that you can directly access any value when you loop to produce the output, without requiring you to repeatedly loop over all of the data to find and display each value.

Sponsor our Newsletter | Privacy Policy | Terms of Service