|
 |
|
ทำเว็บบอร์ด ถ้าสมาชิกมาโพสจะเป็นชื่อสมาชิก ขอตั้งกระทู้ใหม่นะคะ เนื่องจากของเก่าแก้เออเรอร์ได้แล้ว |
|
 |
|
|
 |
 |
|
รูปประกอบนะคะ รูปนี้คือ ddd เป็นสมาชิกบอร์ด แต่ ffff ไม่ได้เป็น
แต่มันวงเล็บว่าเป็น ddd หมดเลย

รูปนี้ล๊อคเอ้าท์ออกคะ คนเป็นสมาชิกดันเป็น guest

|
 |
 |
 |
 |
Date :
2009-07-07 22:07:03 |
By :
SG14 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เวลาเก็บข้อมูลก็เก็บ user_id จะได้รู้ว่าสมาชิกคนไหนโพสต์ แต่ถ้าไม่เป็นสมาชิกก็ใส่ null เข้าไปแค่นี้ก็แยกได้ละครับ
|
 |
 |
 |
 |
Date :
2009-07-08 06:24:13 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ู^
^
^
ตรงไหนคะ แบบว่า ยัง งงๆอ่ะคะรบกวนแนะนำอีกทีนะคะ
|
 |
 |
 |
 |
Date :
2009-07-08 16:45:12 |
By :
SG14 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รบกวนขุดนะคะ ยังรอผู้รู้ชี้แนะคะ
|
 |
 |
 |
 |
Date :
2009-07-08 20:53:34 |
By :
SG14 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
tb_question กับ tb_answer เพิ่มฟิลด์ user_id หรือ member_id ก็ได้เข้าไปแล้วเก็บ id ของ member ที่ online อยู่เข้าไป ถ้าตอบหรือโพสต์โดยไม่ออนไลน์ก็ใส่ null เข้าไป ตอน query ก็ join เข้ากับ table member ก็จะได้แล้วครับ ว่าเป็น guest หรือเปล่า อ้อไม่ต้องใช้ inner join นะครับ ใช้ left join หรือว่า right join แล้วแต่การ query อะครับ แล้วก็ใช้ if เช็คเอาว่า member_id เท่ากับ null หรือเปล่า หรือถ้าจะเขียนเช็คว่า guest หรือเปล่าใน sql command ก็ได้นะใช้ case when แต่ผมว่าใช้ if ดีกว่า เดี๋ยวงง
ผมอธิบายให้งงกว่าเดิมไหมเนี้ย
|
 |
 |
 |
 |
Date :
2009-07-08 21:20:46 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เจ๋งเลยครับพี่ PlaKriM 
|
 |
 |
 |
 |
Date :
2009-07-08 21:25:34 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือ เอา tbregister (อันนี้จะเก็บusername ของสมาชิกไว้)
แล้วก็เอา tbregister ตรงusername ไปjoin กับ tb_question และ tb_answer ทั้ง2ตารางนี้ต้องสร้างฟิลล์เพิ่มมา1อันคือ username หรือว่าต้องใช้user_id คะ แต่user_id นี้เป็น auto incrementอ่าคะในตารางtbregister
ส่วนleft join หรือว่า right join ไม่เคยใช้เลยอะคะ
ถ้าไม่เป็นการรบกวนของ โค๊ดคราวๆแนะนำด้วยนะคะ มึนๆ ~~
|
 |
 |
 |
 |
Date :
2009-07-08 21:28:22 |
By :
SG14 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รบกวนขุดอีกรอบนะคะ รอโค๊ดคราวๆ
ขอแนะนำด้วยนะคะ มึนๆ ~~
|
 |
 |
 |
 |
Date :
2009-07-09 10:12:50 |
By :
SG14 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|