뷰화면에서 파일 설명 업데이트 질문드립니다.
본문
view.skin.php 에서 bf_content (파일설명 업데이트 할려고 합니다.)
view 화면에는 아래 코드를 만들었는데...
view.skin.update.php
쿼리를 헤메고 있읍니다.
bf_no 가져올수가 없네요
업데이트 쿼리 하나 부탁 드립니다
현재 쿼리
$sql = " update {$g5['board_file_table']} set bf_content = '{$bf_content}' where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ";
sql_query($sql);
<!-- View 화면에서 bf_content 내용 업데이트 -->
<form name="fwrite" id="fwrite" action = "<?php echo $board_skin_url ?>/view.skin.update.php" method = "post" onsubmit="return fwrite_submit(this);">
<input type="hidden" name="wr_id" value="<?php echo $view['wr_id']; ?>" id="wr_id">
<input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>" id="bo_table">
<input type="text" name="bf_content" value="<?php echo $view['file'][$i]['bf_content']; ?>" id="bf_content" class="frm_input" size="30" placeholder="파일설명">
<input type = "submit" value = "UPDATE">
</form>
<!-- View 화면에서 bf_content 내용 업데이트 -->
답변 5
차선으로 file 명을 사용해 볼 수도 있을 것 같습니다.
* view.skin.php
<input type="hidden" name="bf_file" value="<?php echo $view['file'][$i]['file'] ?>">
* view.skin.update.php
$sql = " update {$g5['board_file_table']} set bf_content = '{$bf_content}' where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_file = '{$bf_file}' ";
첨부화일이 여러개 일 텐데 몇번째 첨부 화일의 설명을 수정할 것인지 정하는 방법을 알려주셔야죠
그래야 bf_no값을 정할 수 잇으니까요
파일이 하나라면 '0' 을 넣어주면 되지 않을까 합니다.
$i = 0;
$sql = " update {$g5['board_file_table']} set bf_content = '{$bf_content}' where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ";
sql_query($sql);
ㅠㅠ.... 파일이 3~100개 까지 입니다.
산으로 열심히 달려 갑니다 ㅠ...
view.skin.php 스킨에서 출력되는 썸네일 밑에 아래 코드로 bf_content 출력
<!-- View 화면에서 bf_content 내용 업데이트 -->
<form name="fwrite" id="fwrite" action = "<?php echo $board_skin_url ?>/view.skin.update.php" method = "post" onsubmit="return fwrite_submit(this);">
<input type="text" name="bf_count" value="<?php echo count($view['file']) ?>">
<input type="hidden" name="bf_file" value="<?php echo $view['file'][$i]['file'] ?>">
<input type="hidden" name="wr_id" value="<?php echo $view['wr_id']; ?>" id="wr_id">
<input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>" id="bo_table">
<input type="text" name="bf_content" value="<?php echo $view['file'][$i]['bf_content']; ?>" id="bf_content" class="frm_input" size="30" placeholder="파일설명">
<input type = "submit" value = "UPDATE">
</form>
<!-- View 화면에서 bf_content 내용 업데이트 -->
view.skin.update.php 에서 업데이트
echo $bf_count = $_POST['bf_count']; // 첨부 파일 개수
echo $bo_table = $_POST['bo_table']; // bo_table
echo $wr_id = $_POST['wr_id']; // 글번호
echo $bf_content = $_POST['bf_content'] // bf_content
echo $bf_file = $_POST['bf_file']; // file
for ($i=0; $i<($bf_count); $i++) {
$sql = " update {$g5['board_file_table']} set bf_content = '{$bf_content}' where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ";
sql_query($sql);
}
아무 업데이트 버튼 눌려도 전체 파일 설명 업데이트 하고 싶은데....(분리하는거 너무 어려울듯...)
균이님 말씀대로 질문이 잘못 되었네요 ~~
위 코드에서 bf_content 변수로(array??) 받아오고 넣는 방법좀 부탁 드립니다. ~~~
!-->!-->