a_bains Posted April 14, 2007 Share Posted April 14, 2007 Hello, I would like to create a details.php page that displays all my products. I understand how to get the title, price, description etc from mySQL. But my problem is how do I get a list of data? For example say I want to display the features of a product in point form (list). What is the best way to do this? How do most common websites do this? OK, sorry if I am unclear. Here is an example http://www.simplyfta.com/indvitem.php?item_id=10 That site uses PHP and mySQL, it has sections for SPECS and FEATURES. Description is easy you would just use the fetch array function and print it out. But if I want display my data as a list, how would i do that. I am supposing that SPECS and FEATURES are data in an mySQL table row. How do they input that data into mySQL table row to display it on a page using PHP in a list format. I really just want to know the method they used to display a point form list, may also look like its in a table format from a mysql database. Thanks, in advance Aaron Link to comment https://forums.phpfreaks.com/topic/47035-solved-displaying-block-of-text-from-mysql-database/ Share on other sites More sharing options...
Barand Posted April 14, 2007 Share Posted April 14, 2007 How you output depends on how you are storing the data in your database tables Link to comment https://forums.phpfreaks.com/topic/47035-solved-displaying-block-of-text-from-mysql-database/#findComment-229459 Share on other sites More sharing options...
a_bains Posted April 15, 2007 Author Share Posted April 15, 2007 Correct, therefore what would be the best way to store something like that? I am looking to have a list of feature/specs for my products and would like to store them in a mySQL database. I was thinking of having ONE table with all products with fields like (ID, NAME, PRICE, ... ), should SPECS be another field? If so, how would I print it out in a list format? Link to comment https://forums.phpfreaks.com/topic/47035-solved-displaying-block-of-text-from-mysql-database/#findComment-229463 Share on other sites More sharing options...
Barand Posted April 15, 2007 Share Posted April 15, 2007 If your product line is 1 product, wooly jumpers, say, and the spec items are color and size then you might just need [pre] product ---------- id description color size [/pre] But if you are selling electrical items, say microwaves and washing machines, then the items in each group have different sets of specifications so things get a little more complicated [pre] category product prod_spec spec_item ---------- ------------- ----------- ----------- cat_id <----+ prod_id <------- prod_id category | description spec_id -------> spec_id | make value spec_descrip | model +-- cat_id +----- cat_id | | | +------------------------------------------+ [/pre] So spec items for microwaves might be "wattage, capacity, grill" and for washing machine "spin speed, max load, program settings". On the other hand, you might just opt to put the spec in a text field for each product and type out the specification which is simpler but can lead to inconsistencies eg [pre] Watage : 800W (deliberate mispelling to illustrate potential problem) Capacity: 11 litres Grill : 1000W [/pre] Link to comment https://forums.phpfreaks.com/topic/47035-solved-displaying-block-of-text-from-mysql-database/#findComment-229496 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.