글쓴이가 글을 씀과 동시에 댓글을 쓰게할수는 없을까요?? 정보
글쓴이가 글을 씀과 동시에 댓글을 쓰게할수는 없을까요??본문
에...그러니까
입력폼에 글쓰는 공간과 코멘트 쓰는 공간이있어서,
확인을 누르면 글과 코멘트가 한꺼번에 등록되는 기능을 생각하고 있어서요...
가급적 write.skin.php 안에서 해결했으면 좋겠는데,,,고수분들의 조언을 부탁드립니다..ㅇㅇ;;
입력폼에 글쓰는 공간과 코멘트 쓰는 공간이있어서,
확인을 누르면 글과 코멘트가 한꺼번에 등록되는 기능을 생각하고 있어서요...
가급적 write.skin.php 안에서 해결했으면 좋겠는데,,,고수분들의 조언을 부탁드립니다..ㅇㅇ;;
댓글 전체
1. 원글과 코멘트의 차이는 parent 값입니다.
2. 원들의 경우는 폼 내용을 입력하고 최종 id 값을 얻어 parent를 업데이트 합니다.
// 부모 아이디에 UPDATE
sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");
3. 코멘트의 업데이트는 parent값에 원글 id 가 들어가 insert 됩니다.
$sql = " insert into $write_table
set ca_name = '$wr[ca_name]',
wr_option = '$wr_secret',
wr_num = '$wr[wr_num]',
wr_reply = '',
wr_parent = '$wr_id',
4. write_comment_update.php 내용중
$comment_id = mysql_insert_id();
// 원글에 코멘트수 증가 & 마지막 시간 반영
sql_query(" update $write_table set wr_comment = wr_comment + 1, wr_last = '$g4[time_ymdhis]' where wr_id = '$wr_id' ");
// 새글 INSERT
//sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime ) values ( '$bo_table', '$comment_id', '$wr_id', '$g4[time_ymdhis]' ) ");
sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$comment_id', '$wr_id', '$g4[time_ymdhis]', '$member[mb_id]' ) ");
// 코멘트 1 증가
sql_query(" update $g4[board_table] set bo_count_comment = bo_count_comment + 1 where bo_table = '$bo_table' ");
가 들어가야 코멘트 갯수 등이 확인 됩니다.
위 1,2,3,4 를 종합하면
1. 원글 업데이트
2. 원글에 parent 값 원글 id값 넣고
3. 코멘트글 업데이트. parent 값은 원글 id
4. 코멘트 관련 내용 쿼리 실행
의 순서가 되겠네요.
post 로 넘어오는 파라미터 값을 변형해서 코멘트 업데이트 값에 잘 만 넣어주면....
2. 원들의 경우는 폼 내용을 입력하고 최종 id 값을 얻어 parent를 업데이트 합니다.
// 부모 아이디에 UPDATE
sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");
3. 코멘트의 업데이트는 parent값에 원글 id 가 들어가 insert 됩니다.
$sql = " insert into $write_table
set ca_name = '$wr[ca_name]',
wr_option = '$wr_secret',
wr_num = '$wr[wr_num]',
wr_reply = '',
wr_parent = '$wr_id',
4. write_comment_update.php 내용중
$comment_id = mysql_insert_id();
// 원글에 코멘트수 증가 & 마지막 시간 반영
sql_query(" update $write_table set wr_comment = wr_comment + 1, wr_last = '$g4[time_ymdhis]' where wr_id = '$wr_id' ");
// 새글 INSERT
//sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime ) values ( '$bo_table', '$comment_id', '$wr_id', '$g4[time_ymdhis]' ) ");
sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$comment_id', '$wr_id', '$g4[time_ymdhis]', '$member[mb_id]' ) ");
// 코멘트 1 증가
sql_query(" update $g4[board_table] set bo_count_comment = bo_count_comment + 1 where bo_table = '$bo_table' ");
가 들어가야 코멘트 갯수 등이 확인 됩니다.
위 1,2,3,4 를 종합하면
1. 원글 업데이트
2. 원글에 parent 값 원글 id값 넣고
3. 코멘트글 업데이트. parent 값은 원글 id
4. 코멘트 관련 내용 쿼리 실행
의 순서가 되겠네요.
post 로 넘어오는 파라미터 값을 변형해서 코멘트 업데이트 값에 잘 만 넣어주면....