본문 바로가기
프로그래밍/하루하루

댓글 대댓글 dpth sort

by Luhie 2017. 6. 4.

글순서/그룹/depth /sort

1 1 0 1

1 1 1-1 2

1 2 1-1-2 3

1 2 1-1-1 4

1 3 1-1-1-1 5

1 1 1-2 6



2 2 0 1

3

4

5

6




글순서/그룹/depth /sort


uid    gid   depth   comment                           sort     date     user_id  

6 3 0 3 0

5 2 0 2 0

7 2 1 2-1 1

1 1 0 1 0

8 1 1 1-3 1

3 1 1 1-2 2

2 1 1 1-1 3

4 1 2 1-1-1 4




6 3 0 3 0


5 2 0 2 0

9       2       1       2-2                             1

7 2 1 2-1 2

7 2 2 2-1-2 3

10 2 2 2-1-1 4


1 1 0 1 0

8 1 1 1-3 1

3 1 1 1-2 2


3 1 2 1-2-3 3


3 1 2 1-2-2 3

내가 가진 gid랑 같은 애들 중에 내가 가진 소트 번호랑 같으면서 큰 것들에게 +1

3 1 2 1-2-1 4

2 1 1 1-1 5

4 1 2 1-1-1 6




부모글에 댓글을 달면 gid를 검색해서 자식이 갖고 

depth+1

내 부모의 소트에 +1












1. gid가 같은 번호중에 depth가 같은것중에 sort가 제일 높은 것에 +1 해서 내가 갖고

2. 내가 가진 sort 뒤의 번호들은 하나씩 ++1 업데이트



// 원래면 3이 되어야 하지만 보여질때 같이있어야하니까 

2가 되고 위에껄 3으로 업데이트 

글순서/그룹/depth /sort

1 1 0 1 0

3 1 1 1-2 1

2 1 1 1-1 2

4 1 2 1-1-1 3

5 2 0 2 0

7 2 1 2-1 1

6 3 0 3 0




update tb_comment

set sort=sort+1

where

gid ='19' and sort >='1'



/ 루트

./ 현재

../ 전폴더

../../ 전전 폴더


/a.html 해도 현재 폴더를 불러올 수 없어


/asdfsd/asdf/asdf.html



update tb_comment

set sort=sort+1

where

gid ='19' and sort >='1'





부모의 depth/sort/ 에 +1하고

그룹아이디가 같고 내가 작성한 idx값보다 전에 작성된글 중 내sort 보다 크거나 같은애들만 업데이트

INSERT INTO tb_comment

(gid, depth, sort, user_id, content, i_stamp)

VALUES (1,  1+1,  1+1, '1', 'a-1-2', UNIX_TIMESTAMP() );


update tb_comment set sort=sort+1 where gid="1" and uid<LAST_INSERT_ID() and sort>= 1+1 ;



'프로그래밍 > 하루하루' 카테고리의 다른 글

[Android] 1  (0) 2017.07.15
과제 2  (0) 2017.05.23
과제 1  (0) 2017.05.19