두개이상 이미지 파일을 올리면 자꾸 다른 게시글에 올라왔던 사진이 연동이 되는데 도와주세요ㅠㅠ..
|
답변 3개 / 댓글 1개
채택된 답변
+20 포인트
eyekiss
3년 전
Copy
<div class="index_botoom_img_content">
<?php
$sql = "SELECT * FROM `g5_write_clean_gallery` ORDER BY `wr_id` DESC LIMIT 10";
$result = mysqli_query($connect_db, $sql);
$gallery = array();
$galleryfile = array();
for($i=0; $row = mysqli_fetch_assoc($result); $i++){
$gallery[$i] = $row;
$sql2 = "SELECT * FROM g5_board_file WHERE bf_no = 0 AND bo_table = 'clean_gallery' AND wr_id='{$row['wr_id']}'";
$result2 = mysqli_query($connect_db, $sql2);
$row2 = mysqli_fetch_assoc($result2);
$galleryfile[$i] = $row2;
}
?>
<div class="gallery_wrap">
<?php
for($i = 0; $i < count($gallery); $i++){ ?>
<a href="<?php echo '/bbs/board.php?bo_table=clean_gallery&wr_id='.$gallery[$i]['wr_id']; ?>" class="gallery_box">
<div class="gal_img">
<img src="<?php echo G5_DATA_URL ?>/file/clean_gallery/<?php echo $galleryfile[$i]['bf_file']; ?>" alt="">
</div>
<div class="gal_text">
<p><?php echo $gallery[$i]['wr_subject']; ?></p>
</div>
</a>
<?php }
?>
</div>
</div>
Copy
<div class="index_botoom_img_content">
<?php
$sql = "SELECT * FROM `g5_write_clean_gallery` ORDER BY `wr_id` DESC LIMIT 10";
$sql2 = "SELECT * FROM g5_board_file WHERE bf_no = 0 AND bo_table = 'clean_gallery'";
$result = mysqli_query($connect_db, $sql);
$result2 = mysqli_query($connect_db, $sql2);
$gallery = [];
$galleryfile = [];
while($row = mysqli_fetch_assoc($result)){
$gallery[] = $row;
}
while($row = mysqli_fetch_assoc($result2)){
$galleryfile[] = $row;
}
?>
<div class="gallery_wrap">
<?php
for($i = 0; $i < count($gallery); $i++){ ?>
<a href="<?php echo '/bbs/board.php?bo_table=clean_gallery&wr_id='.$gallery[$i]['wr_id']; ?>" class="gallery_box">
<div class="gal_img">
<img src="<?php echo G5_DATA_URL ?>/file/clean_gallery/<?php echo $galleryfile[$i]['bf_file']; ?>" alt="">
</div>
<div class="gal_text">
<p><?php echo $gallery[$i]['wr_subject']; ?></p>
</div>
</a>
<?php }
?>
</div>
</div>
eyekiss
3년 전
첫번째 게시물을 가져온 데이터에서 다시 파일을 가져오면 됩니다.
(소스로 올려주셔야 답변이 용이합니다.ㅜㅜ)
while($row = mysqli_fetch_assoc($result)) {
$gallery{} = $row;
$sql2 = "select * from g5_board_file where bo_table='clean_gallery' and wr_id='{$row['wr_id']}' and bf_no=0";
$result2 = ~~~
while($row2 = ~~~~) {
$galleryfile[] = $row2;
}
}
답변에 대한 댓글 1개
yunj3723
3년 전
죄송합니다 ㅠㅠ 글을 처음 올려봐서요..!! 제가 초보라 그런지 어느부분에 들어가야하는지 정확하게 잘 몰라서..한번 더 알려주실수 있나요?
답변을 작성하려면 로그인이 필요합니다.