|
 |
|
การออกแบบ database ของ หมวดหมู่สินค้า ให้สามารถ เพิ่ม sub ได้ |
|
 |
|
|
 |
 |
|
หลักการคิดไม่ยากครับ
Catagory คือ หมวด
Product คือ สินค้า และมีคุณสมบัติเป็น Elenment ของ Catagory
เพราะฉะนั้น ถ้าอยากรู้ Product ไหนอยู่ Catagory อะไร ก็ใส่ key ของ Catagory ไปด้วยฟิวด์นึงครับ
ตัวอย่าง
table Catagory
- Cat_id
- Cat_name
table Product
- Product_id
- Product_name
- Cat_id // ตัวนี้แหล่ะครับ เอาไว้สร้าง relation
ตัวอย่างการ select
Code (PHP)
$sql = mysql_query("selec product.*,Cate_name from product p inner join catagory c on p.Cate_id = c.Cat_id");
/// พอใจน่ะครับ ถ้างงถามต่อได้
เพราะ ฉะนั้น การเพิ่ม Sub ก็ใช้หลักการตามนี้ได้เลยครับ    
|
ประวัติการแก้ไข 2012-03-06 18:18:51
 |
 |
 |
 |
Date :
2012-03-06 18:17:48 |
By :
mangkunzo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|