특정여분필드의 동일한 값을 가진 게시물들만 최신글로

특정여분필드의 동일한 값을 가진 게시물들만 최신글로

QA

특정여분필드의 동일한 값을 가진 게시물들만 최신글로

본문

특정여분필드의 동일한 값을 가진 게시물들만 최신글로 가져오려고

latest.lib.php

$sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} ";

요걸 찾아서 요렇게 바꾸고

$sql = " select * from {$tmp_write_table} where {$options} wr_is_comment = 0 order by wr_num limit 0, {$rows} ";

불러올 페이지에서 

<?php echo latest("theme/basic", "test", "5", "30");?>

<?php echo latest("theme/basic", "test", 5, 30, 1, "wr_13='기본' and "); ?>

즉 wr_13의 값이 '기본'인 게시물만 불러오려고 하는건데 어디가 잘못된걸까요?

 

이 질문에 댓글 쓰기 :

답변 1

안녕하세요.

아래의 코드를 참고해 보시겠어요~

 

1. latest() 함수에 $extra_condition이라는 추가 인자를 받도록 수정

 

function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $extra_condition="")

 

2. SQL 쿼리문에서 이 $extra_condition을 사용하도록 수정
$sql = " select * from {$tmp_write_table} where {$extra_condition} wr_is_comment = 0 order by wr_num limit 0, {$rows} ";

 

3.latest() 함수를 호출할 때 추가 조건을 넘겨줄 수 있음

<?php echo latest("theme/basic", "test", 5, 30, 1, "wr_13='기본' and "); ?>


 

답변을 작성하시기 전에 로그인 해주세요.
전체 424
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT