What is the best way to store product description/details in a database table. PHP mysql -


let's have product these descriptions (displayed so, 1 per line):

description 1

description 2

description 3

description 4

.

.

description n

what best way store these product descriptions in database table can displayed in "description" tab of dynamic product page.

i avoid creating n different table columns, 1 each description.

thank suggestions

create relation table.

product table:

id name serial .... 

description table:

id product_id description order / 1,2,3,n/ 

and can:

$sql = "select * descriptions"     . " product_id  = " . $productid . ""     . " order `order`"; 

read more it: http://en.wikipedia.org/wiki/database_normalization

edit

i've added on order column, because i'ev assume, want display description in correct order. if not use order field, can't sure, when selecting descriptions 1 product, order them.

id | product_id | description | order 1    1              1                   first desc   2    1              3                   3rd  3    1              2                   2nd 

so have freedom add description in order, keep proper orders. order field name can other name eg: desc_order.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -