게시판 리스트 화면을 랜덤으로 출력 질문 드립니다.
본문
게시판 리스트 화면을 랜덤으로 출력에서 공지글하고 wr_1=1인것만빼고 랜덤 출력 하고 싶습니다.
<?php
shuffle($list);
for ($i=0; $i<count($list); $i++) {
?>
답변 2
list.php
if ($sca || $stx) {
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows ";
} else {
$sql = " select * from {$write_table} where wr_is_comment = 0 ";
if(!empty($notice_array))
$sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
$sql .= " {$sql_order} limit {$from_record}, $page_rows ";
}
이러게 되어있는데요
이부분에 아래소스를 넣으면
if($bo_table=='적용시킬 게시판 table이름')
$sql="select * from {$write_table} where wr_1!=1 and wr_is_comment = 0 order by rand() limit {$from_record}, $page_rows ";
}
아마 작동 하지 안을까 생각되네요
쿼리를 where wr_1!='1' order by rand() 로 바꾸거나
위코드에서
if($list[wr_1]!=='1'){
추가여