첨부파일 2번째 이미지 뽑기 채택완료
<?
for($i=0;$i<count($list);$i++){
$sql="SELECT * FROM g4_board_file where bo_table='01_board' and wr_id='{$list[$i][wr_id]}' order by bf_no=1 desc ";
//echo $sql;
//exit;
$result = sql_query($sql);
$row= sql_fetch_array($result);
?>
<li><img src="/data/file/01_board/<?=$row['bf_file']?>" onerror="this.src='/images/noimage.gif'"
게시물마다 다른 이미지여야 하는데.. 하나만 나오네요..
답변 1개
채택된 답변
+20 포인트
9년 전
by bf_no=1 desc 이부분이
첫번째파일이 no1이고 두번째면 by bf_no=2 desc 로 해야하지 않을까요?
로그인 후 평가할 수 있습니다
답변에 대한 댓글 4개
9년 전
다시보니 쿼리문이 잘못된거같은데요?
$sql="SELECT * FROM g4_board_file where bo_table='01_board' and wr_id='{$list[$i][wr_id]}' and bf_no = '1' ";
이렇게만하면 무조건 2번째 파일이 쿼리문으로 읽힐텐데용
desc를 해줄 이유를 모르겠네요
$sql="SELECT * FROM g4_board_file where bo_table='01_board' and wr_id='{$list[$i][wr_id]}' and bf_no = '1' ";
이렇게만하면 무조건 2번째 파일이 쿼리문으로 읽힐텐데용
desc를 해줄 이유를 모르겠네요
9년 전
네
$sql="SELECT * FROM g4_board_file where bo_table='01_board' and wr_id='{$list[$i][wr_id]}' and bf_no = '1' ";
이렇게요 해보세용
$sql="SELECT * FROM g4_board_file where bo_table='01_board' and wr_id='{$list[$i][wr_id]}' and bf_no = '1' ";
이렇게요 해보세용
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인