묻고답하기

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

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 남기남
jin08 seo모듈 설치문의 [1] 2019.04.11 by sejin7940
베니 <body> 수정하는 방법 문의드립니다. [2] 2019.04.11 by 베니
그랜트 1.5 업데이트 이후 plannerXE123 일정 표시안됨 [1] 2019.04.11 by chorok
chorok PlannerXE123 업데이트 후 오류 file  
쪼리짱 게시판 첨부파일 업로드시 100% 이후 파일 업로드가 안됩니다. [2] file 2019.04.10 by SimpleCode
이와이 특정 페이지의 영문으로 바로 가는 링크 [1] 2019.04.10 by sejin7940
음메 페이지 비공개 [1] 2019.04.10 by SimpleCode
BarryWhite 회원 가입 시 버튼 누르면 서버오류가 뜨네요. [1] file 2019.04.09 by BarryWhite
동혀니 모바일 페이지 도움주실분 찾아요.  
『나』『na』 게시판 가로스크롤을 없애는 방법좀요.. [2] 2019.04.09 by 생크림
incation 첨부파일 순서 좀 바꾸고 싶음 file  
Hees 게시판 썸네일목록은 출력되는데 클릭하면 게시물 내용이 안나옵니다. [2] file 2019.04.08 by Hees
천하무적c8ea4 '요청한 파일을 찾을 수 없습니다.'라는 메세지 나옵니다.  
베니 네이버 애널리틱스 수집이 안되네요;; file  
PAIN php로 포인트저장 [5] 2019.04.06 by PAIN
윈터서버 https://woto.net/ 웹호스팅 업체 설치문제 [4] 2019.04.06 by 우주학개론
nong 알려주세요  
바보멍청이 데이터 이전 툴 - php.ini 환경설정에서 원격지의 파일을 열지 못하도록 되어 있습니다. [10] file 2019.04.05 by 디자인클립
chorok 무슨 기반으로 제작된 사이트일까요? [1] file 2019.04.05 by 디자인클립
rail_man 회원가입시 이메일 인증 [1] 2019.04.05 by sejin7940
댄져러스 탈퇴방법좀 해외사이트 이것좀해석해주세요 file  
결이아빠 ssl 문제가 확실한데..어떻게 해야할지..  
결이아빠 어떻게 수정하면 될까요?  
이퓨 회원가입 select 폼 형식 입력값 불러오기 질문 file  
한이흔 이미지 첨부 후 본문 삽입시 문제...몇일째 해결이 안돼여.. [1] 2019.04.02 by 결이아빠
일과여행 카톡으로 도메인을 전송하면 자동으로 나오는 이미지를 바꿀 수 없나요? [1] file 2019.04.02 by 디자인클립
모로지로 홈에 문서 이미지 넣기 문의드려요.. [2] 2019.04.02 by 모로지로
소라db952 cycle-pager 배너에 a 링크를 걸면 배너 이미지가 풀려요ㅠ [2] 2019.04.02 by 소라db952
검은고양이냐옹 레이아웃 스킨의 메뉴에 선을 하나 긋고 싶어요.. [5] file 2019.04.02 by DoorWeb
Krazee content 위젯 사진 교체 방법?? [1] file 2019.04.01 by 디자인클립