묻고답하기

엑셀 출력시 에러메세지가 발생이 되는데 어떻한 부분을 바꿔야 할까요?

3.png

 

<?php

//url 로 직접 불러오는것을 방지

if(!strstr($_SERVER['HTTP_REFERER'],$_SERVER['SERVER_NAME'])&& !strstr($_SERVER['HTTP_REFERER'],'out_excel.php')) exit;

 

$info = array(

"host" => "localhost",

"user" => "root",

"pass" => "autoset",

"db" => "dt",

"table" => "dt_documents",

"module_srl" => "737",

);

$getFields = array("title","regdate","content"); //출력원하는 칼럼을 배열로 입력

 

header("Content-type: application/vnd.ms-excel");

header("Content-Disposition: attachment; filename=doc_".date('Ymd').".xls");

 

 

$con = mysql_connect($info[host], $info[user], $info[pass]) || die(mysql_error());

mysql_query("set names utf8");

$con_db = mysql_select_db($info[db]) || die(mysql_error());

?>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv=Content-Type content=text/html; charset="utf-8">

</head>

<body>

<table border=1>

<tr align=center>

 

<?php

//제목 불러오기

$fields = mysql_list_fields("$info[db]", "$info[table]");

$columns = mysql_num_fields($fields);

 

for( $i=0 ; $i<$columns ; $i++ )

{

    $field[$i]=mysql_field_name($fields, $i);

    if( in_array($field[$i], $getFields) ) echo "<th>".$field[$i]."</th>";

}

 

//확장변수의 타이틀은 값이므로       

$result = mysql_query("select  var_name from xe_document_extra_keys where module_srl = $info[module_srl]");                  

while( $data = mysql_fetch_array($result) )

{                          

    echo "<th>".htmlspecialchars($data[var_name])."</th>";

}  

 

echo"</tr>";             

 

 

//데이터 불러오기

$result = mysql_query("select * from $info[table] where module_srl = $info[module_srl]");

while( $data = mysql_fetch_assoc($result) )

{

    echo"<tr>";

    foreach( $data as $key => $val )

    {

        if( in_array($key, $getFields) ) 

        {

            if ($key ==  'regdate') { 

                echo "<td   style='mso-number-format:\"0_ \";' >".htmlspecialchars($val)."</td>";               

            }elseif ($key ==  'content'){       //내용 출력할경우 태그가 그대로 출력됨         

                //echo "<td>".$val."</td>";     //셀이 두칸이상으로 늘어남

                echo "<td >".htmlspecialchars(strip_tags(str_replace(" ","",$val)))."</td>";

            }else {

                echo "<td>".htmlspecialchars($val)."</td>";

            }  

        }

 

        if ($key ==  'document_srl'){           //확장변수 불러올때 사용

            $d_srl=$val;

        }

 

    }

                //확장변수 출력 ////////////////////////////////////////////

                //eid리스트를 불러온다

                $query=mysql_query("select eid from xe_document_extra_keys where module_srl = $info[module_srl]");      

                while($extra_title=mysql_fetch_array($query))

                {      

                    echo"<td>";

 

                    $egetFields = array("value","eid");  

                    //확장변수 값을 불러와 eid값이 같은곳에 출력

                    $extra_result = mysql_query("select * from xe_document_extra_vars where document_srl = $d_srl");  

                    while( $edata = mysql_fetch_assoc($extra_result) )

                    {

                        $extra_str="";

                        foreach( $edata as $key => $val ){

                            if( in_array($key, $egetFields) ){                          

                                $extra_str = $val.",".$extra_str;

                            }

                        }

 

                        $extra_arr=explode(",",$extra_str);                                

                        if ($extra_title[eid]==$extra_arr[0]){

 

                            //전화번호값은 "|@|" 를 "-" 로 변경

                            if($extra_title[eid]=="mb_phone_Number"){

                                echo str_replace("|@|","-",htmlspecialchars($extra_arr[1]));

 

                            //기타 배열값들은 ',' 로 변경

                            }elseif($extra_title[eid]=="mb_incomplete"||$extra_title[eid]=="mb_cs"){

                                echo str_replace("|@|",",",htmlspecialchars($extra_arr[1]));

                            }else{

                                echo htmlspecialchars($extra_arr[1]);                     

                            }

                        }

                    }

 

                    echo"</td>";   //eid값이 없으면 빈칸입력

                }              

                /////////////////////////////////////////////////////////////////////

 

    echo"</tr>";

}

 

 

?>

</table>

</body>

</html>

 

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
한형석 동영상 강의 구현 가능한가요? [1] 2018.11.14 by Kants.kr
BJVolvo이현석 배너 [2] file 2018.11.14 by Kants.kr
판도라 모바일에서 헤더 스크립트가 나오게 할 수는 없을까요? [4] file 2018.11.14 by 판도라
astraea 쪽지보내기 오류 부탁드립니다 ㅠㅠ  
jayj8 메시지 모듈 삭제후 계속 나타나는 태그 file  
iwrtn45 Xpress Engine사용하면 네이버 카페같은 상세한 권한가진 게시판 생성 가능한지요? [1] 2018.11.15 by sejin7940
박황재 글 작성자에게 포인트를 줄 수 있는 기능 문의 드립니다. [2] file 2018.11.15 by 박황재
hyojae**** 첨부파일 경로수정 가능??? [1] 2018.11.15 by sejin7940
matad 고수님들 html도와주세요ㅜㅜㅜㅜㅜㅜㅜ [2] 2018.11.16 by matad
모얼더 메뉴 주소 변경시 자동 이동 [2] 2018.11.16 by 모얼더
에프닷 XE에서 도메인 변경후 사진이 나오질 않습니다. [3] 2018.11.16 by 에프닷
하상민 썸네일 생성시 생성된 파일 크기와 파일명이 일치하지 않습니다.  
musicholic ko 아이콘 안보이게 하려면 어떻게 해야 하나요 [1] file 2018.11.20 by 도토리묵
작곡가양수혁 게시판 분류 수정이 안됩니다. ㅠㅠ 도와주세요... [1] file 2018.11.20 by sejin7940
ecli**** 로그인 먹통 -- 뭐가 문제일까요? 도와주세요 선배님 ㅠㅠ [2] 2018.11.20 by 이상철
dAli 헤더 중앙 정렬 [1] file 2018.11.20 by DoorWeb
땀모 에디터창에서 HTML편집기에서 CSS코드를 주면 [2] file 2018.11.20 by DoorWeb
코딩펀 회원 정보 마이그레이션 1.4.4.4 -> 1.11.1 이 안되고 있습니다. 고수님들 도와주세요~ [1] 2018.11.20 by sejin7940
꽃민 마우스 휠 한번에 한페이지가 내려가게 하는방법! 질문! [2] 2018.11.20 by sejin7940
짱구 소셜 SNS태그에 인스타그램과 카카오톡이 없는데 사용할 수 있는 방법이 있나요? [1] 2018.11.20 by sejin7940
editor를 하단으로만 늘어나게 하고 싶습니다. [4] 2018.11.20 by
개발자티케 관리자 설정 일반에서 기본 URL 변경후 에러가 나요 후.. file  
이와이 content 위젯 탭 형식 관련  
wae13 레이아웃 문제? 줄바꿈 문제가 있습니다 file  
슬로우바이크 axupload5 에디터의 큐박스 내 파일 순서 정렬에 대해 질문드립니다 [1] 2018.11.23 by 슬로우바이크
이동헌 위젯별로 색상을 랜덤으로 하고 싶어요. [1] 2018.11.23 by sejin7940
토실이 멀티도메인 이용중 질문입니다. [2] 2018.11.25 by 우주학개론
사이후이 이사이트가 xe사이트인가요? [3] 2018.11.25 by 우주학개론
hgh0328 아이디찾기 jsp파일 문의 드립니다. [1] 2018.11.25 by 우주학개론
엽궐 [iptime nas] XE사용중 코어 업데이트 후 HTTP ERROR 500 [2] 2018.11.25 by LeeMark