테스트 사이트 - 개발 중인 베타 버전입니다

게시판 엑셀 다운로드 코드 ? 채택완료

kjwkjm 7년 전 조회 2,942

<?
$excel_down =  "g5_write_notice" . $_GET['bo_table']; //엑셀 다운로드 테이블 설정 g5_write 는 기본 그누 세팅시 자동으로 붙습니다.
$wr_id = $id = $_GET['wr_id'];

include "../../../dbconfig.php";
$db_conn = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die('서버에 접속하지 못했습니다.');
mysql_select_db($mysql_db, $db_conn);
//@mysql_query("SET CHARACTER SET utf8");  // 한글깨지면 주석해지

if ($ms =="excel"){
$g5[title] = "엑셀 문서 다운로드";
  header( "Content-type: application/vnd.ms-excel" );
  header( "Content-Disposition: attachment; filename=상담신청.xls" );
  //header( "Content-Description: PHP4 Generated Data" );
 } else if ($ms =="power"){
 $g5[title] = "파워포인트 문서 다운로드";
  header( "Content-type: application/vnd.ms-powerpoint" );
  header( "Content-Disposition: attachment; filename=상품구매.ppt" );
  // header( "Content-Description: PHP4 Generated Data" );
 } else if ($ms =="word"){
  $g5[title] = "워드 문서 다운로드";
  header( "Content-type: application/vnd.ms-word" );
  header( "Content-Disposition: attachment; filename=상품구매.doc" );
  //header( "Content-Description: PHP4 Generated Data" );
 } else if ($ms =="memo"){
  $g5[title] = "메모 문서 다운로드";
  header( "Content-type: application/vnd.ms-notepad" );
  header( "Content-Disposition: attachment; filename=상품구매.txt" );
 } else {
  header( "Content-type: application/vnd.ms-excel" );
  header( "Content-Disposition: attachment; filename=상품구매.xls" );
 }
  header( "Content-Description: PHP5 Generated Data" );

 

$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down where wr_is_comment = '0' and wr_content = '$wr_id' "));
        $result=@mysql_query("select * from $excel_down where wr_is_comment = '0'  and wr_content = '$wr_id' order by wr_datetime desc");

      $number=$temp[0]
?>

스킨 게시판 폴더에 excel.php 파일 업로드 하고

 

했는데 뭐가 잘못 되었는지 excel 버튼을 클릭하면 엑셀은 다운 되는데 안에

 

아무것도 출력이 안되네요 어디가 잘못 된걸까요 ㅠ ?

 

https://sir.kr/g4_tiptech/24559" target="_blank">https://sir.kr/g4_tiptech/24559

 

위에 링크 보고 작업햇습니다.

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

l
7년 전

아래문장을 이해하지 못하신다면 의뢰게시판에 의뢰하셔야 할것 같습니다만..

 

echo 로 출력된 부분의 쿼리를 직접 쿼리창(phpadmin 과 같은..)에서 실행해 보세요

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

l
7년 전

</p>

<p>echo "select count(*) from $excel_down where wr_is_comment = '0' and wr_content = '$wr_id' ".'
';

echo "select * from $excel_down where wr_is_comment = '0'  and wr_content = '$wr_id' order by wr_datetime desc".'
';</p>

<p>

echo 로 출력된 부분의 쿼리를 직접 쿼리창(phpadmin 과 같은..)에서 실행해 보세요

쿼리가 잘못되었을 겁니다

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인