첨부파일을 select로 가져오려고 합니다.

첨부파일을 select로 가져오려고 합니다.

QA

첨부파일을 select로 가져오려고 합니다.

본문

<?

$sql = "select * from g5_write_15_board where wr_good = 0";

$row = sql_query($sql);

$aa = sql_fetch_array($row);

 

//echo $aa['wr_file'];

?>

 

이런 식으로 가려오려고 하는데..

첨부파일명이 안뜨고 1이라고 뜨네요..ㅠ

일반페이지에서 가려오려면 이 방법으로 하면 안되는 건가요?

 

 

이 질문에 댓글 쓰기 :

답변 3

반복문 돌려주세요~

 

while($aa = sql_fetch_array($row)){

echo "<select~~~~";

echo "<option~~~~~".$aa['wr_file'] . "</option>";

echo "</select>";

 

$sql = "select * from g5_write_15_board where wr_good = 0"; 는 첨부파일 쿼리가 아닙니다.

select * from $g5['board_file_table'] where bo_table = '게시판명' and wr_id = '게시판wr_id값'

으로 쿼리를 변경해보세요


$aa['wr_file'] 도 첨부파일이 아닙니다.

bf_file 필드가 첨부파일명이 저장되는 필드입니다.

get_file 함수가 있으니 함수 내용을 참고해서 작성하세요

 

// 게시글에 첨부된 파일을 얻는다. (배열로 반환)
function get_file($bo_table, $wr_id)
{
    global $g5, $qstr;

    $file['count'] = 0;
    $sql = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no ";
    $result = sql_query($sql);
    while ($row = sql_fetch_array($result))
    {
        $no = $row['bf_no'];
        $file[$no]['href'] = G5_BBS_URL."/download.php?bo_table=$bo_table&wr_id=$wr_id&no=$no" . $qstr;
        $file[$no]['download'] = $row['bf_download'];
        // 4.00.11 - 파일 path 추가
        $file[$no]['path'] = G5_DATA_URL.'/file/'.$bo_table;
        $file[$no]['size'] = get_filesize($row['bf_filesize']);
        $file[$no]['datetime'] = $row['bf_datetime'];
        $file[$no]['source'] = addslashes($row['bf_source']);
        $file[$no]['bf_content'] = $row['bf_content'];
        $file[$no]['content'] = get_text($row['bf_content']);
        //$file[$no]['view'] = view_file_link($row['bf_file'], $file[$no]['content']);
        $file[$no]['view'] = view_file_link($row['bf_file'], $row['bf_width'], $row['bf_height'], $file[$no]['content']);
        $file[$no]['file'] = $row['bf_file'];
        $file[$no]['image_width'] = $row['bf_width'] ? $row['bf_width'] : 640;
        $file[$no]['image_height'] = $row['bf_height'] ? $row['bf_height'] : 480;
        $file[$no]['image_type'] = $row['bf_type'];
        $file['count']++;
    }

    return $file;

$files = get_file($bo_table, $wr_id);

print_r2($files);

echo $files['count'];

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

회원로그인

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