slq코드관련 문의드립니다. 채택완료
socol
8년 전
조회 2,649
특정 게시판, 리스트 상에서 내가 스크랩한 게시물을 불러오는 코드인데요..
</p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"><?php </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);">$sql3 = " select * FROM $write_table left join g5_scrap on $write_table.wr_id=g5_scrap.wr_id where g5_scrap.mb_id='{$member['mb_id']}' && g5_scrap.bo_table='{$board['bo_table']}'";</p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);">//현재 게시판DB와 스크랩DB 비교해서 로그인 아이디로 스크랩된 게시물 찾기 </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);">$result3 = sql_query($sql3); </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);">for ($k=0; $row3=sql_fetch_array($result3); $k++) { </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> $row3['opener_href_wr_id'] = './board.php?bo_table='.$row3['bo_table'].'&wr_id='.$row3['wr_id']; </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> $Sdate = substr($row3['wr_datetime'],0,10); </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> ?> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <tr class="bo_notice"> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <td class="td_num"> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <?php </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> echo '<strong>스크랩</strong>'; </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> ?> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> </td> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <?php if ($is_checkbox) { ?> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <td class=""></td> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <?php } ?> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <td class=""> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <a href="<?php echo $row3['opener_href_wr_id'] ?>"> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <?php echo $row3['wr_subject'] ?> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> </a> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> </td> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <td class=""><?php echo $row3['wr_name'] ?></td> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <td class="td_num"><?php echo $Sdate ?></td> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <td class="td_num"><?php echo $row3['wr_hit'] ?></td> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <?php if ($is_good) { ?><td class="td_num"><?php echo $row3['wr_good'] ?></td><?php } ?> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <?php if ($is_nogood) { ?><td class="td_num"><?php echo $row3['wr_nogood'] ?></td><?php } ?> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> </tr> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> <?php }?> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);"> </p><p style="word-break: break-all; font-family: dotum; font-size: 15px; background-color: rgb(255, 255, 255);">
이 코드를 넣으면 불러와지는데요....
제 게시판 테이블 이름이 bo_table=ev1
ev1인데
그래서 자동으로 ev1 테이블에 있는것이 불러와지는데요
ev2이란 테이블도 있는데
ev2이란 테이블에서도 ev1에서 스크랩했던 저 코드들을
불러오려면
코드를 어떻게 짜야될까여??
도움좀 부탁드립니다
현재 저 코드를 게시판 list스킨에 넣으면
리스트 상에서
내가 스크랩했던 게시물이 불러와집니다
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
8년 전
<?
$list_bo_table = "ev1";
$list_table = $g5['write_prefix'].$list_bo_table;
$sql3 = " select * FROM $list_table left join g5_scrap on $list_table.wr_id=g5_scrap.wr_id where g5_scrap.mb_id='{$member['mb_id']}' && g5_scrap.bo_table='{$list_bo_table}'";
?>
$write_table 변수를 쓰는경우 기존 게시판과 겹칠수도 있어서
$list_table 로 테이블 변수는 변경하였습니다.
상단을 위와 같이 고치시면 ev1 의 스크랩한 게시물을 가져올수 있습니다.
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
s
socol
8년 전
감사합니다~
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인