게시판리스트를 엑셀변환이 왜 안될까요?

게시판리스트를 엑셀변환이 왜 안될까요?

QA

게시판리스트를 엑셀변환이 왜 안될까요?

답변 1

본문

그누4에서 해피정님이 올려주신 소스를 그누5로 변경한 후에 진행하니 엑셀변환이 잘 안되네요

아래 소스보시고 잘못된 부분 알려주시면 정말 감사드리겠습니다 ^^

 

<?
$excel_down = "g5_write_" . $_GET['bo_table']; //엑셀 다운로드 테이블
$wr_id = $id = $_GET['wr_id'];

include "../../../data/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 utf-8");  // 한글깨지면 주석해지


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"){
  $g45[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: PHP4 Generated Data" );

// 원글 + 코멘트 다운로드
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down "));
$result=@mysql_query("select * from $excel_down order by wr_datetime desc");

// 원글만 다운로드 (코멘트 제외) ,  2013-10-21 추가
//$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];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">

.txt {mso-number-format:'\@'}
</style>
</head>

<body>
<table>
  <tr>
    <td>번호</td>
    <td>제목</td>
    <td>아이디</td>
    <td>이름</td>
    <td>작성일</td>
    <td>이메일아이디</td>
    <td>이메일</td>
    <td>상품권번호</td>
    <td>주소</td>
    <td>핸드폰번호</td>
  </tr>

<?
while($data=mysql_fetch_array($result)) {
echo "
  <tr>
    <td>$number</td>
    <td>$data[wr_subject]</td>
    <td>$data[mb_id]</td>
    <td>$data[wr_name]</td>
    <td class='txt'>$data[wr_datetime]</td>
 
    <td class='txt'>$data[wr_1]</td>
    <td class='txt'>$data[wr_2]</td>
    <td class='txt'>$data[wr_5]</td>
    <td class='txt'>$data[wr_9]</td>
    <td class='txt'>$data[wr_10]</td>
  </tr>
";
  $number--;
  }
?>
</table>
</body>
</html> 

이 질문에 댓글 쓰기 :

답변 1

아래처럼 바꾸어야 됩니다

$mysql_host, $mysql_user, $mysql_password ----> G5_MYSQL_HOST, G5_MYSQL_USER, G5_MYSQL_PASSWORD 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 124,025
© SIRSOFT
현재 페이지 제일 처음으로