묻고답하기

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

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 남기남
익명1230 xe 업데이트 후 확장 컴포넌트 이용에 문제가 생겼습니다 [3] file 2019.06.17 by mss
pjk**** xe 1.9.8 에서 업데이트 후 에디터 컴포넌트 동작문제  
인천한량 php7.2 대응오류 혹은 권한 수정후 글작성시 첨부파일 이미지에 웹링크 오류 [3] file 2019.06.16 by 인천한량
처음부터끝까지 xe 에서 주소를 폴더 형식으로 할수 있을까요? [2] 2019.06.15 by 처음부터끝까지
Enki sejin님꺼보고 simple스트랩 적용했는데 [3] 2019.06.13 by Enki
JNSIDE 안녕하세요. 가장 기본중에 기본인데 궁금해서 글을 남겨 봅니다 [3] file 2019.06.12 by 제이와이엔소프트
아서케이 배너클릭시 클릭율보는방법 질문드립니다 [3] 2019.06.12 by sejin7940
woobi 첨부파일 본문 삽입 다운로드 에러 [2] 2019.06.11 by woobi
Enki 게시글 new file 버튼 글자 변경 [1] 2019.06.11 by DoorWeb
예디 db복구 후 디자인 수정이 안됩니다 [1] file 2019.06.11 by sejin7940
인천한량 퍼미션 변경을 했더니 경로상 db config.php 파일이 다운로드 됩니다... [4] file 2019.06.11 by 인천한량
Enki 에디터 첨부파일을 넣으면 <p> </p> 가 입력되어 이미지와 글이 떨어져 보입니다 [1] 2019.06.11 by DoorWeb
Odiac 게시판 글 "등록"버튼을 클릭해도 반응이 없어요 [2] 2019.06.11 by Odiac
hatali ezmember(회원가입) 모듈 문제없이 사용하시는 분 계신가요?  
나석원 게시판 제목을 넣지 않으면 항상 같은 제목으로 입력되게.. [2] 2019.06.10 by Odiac
아옮옮 이번에 쿠키 카운트를 연습중인데 왜 본문 출력이 안될까용... [1] file 2019.06.10 by SimpleCode
hatali "리디렉션한 횟수가 너무 많습니다" 오류 문의 [2] 2019.06.10 by hatali
goji 게시판 글 미입력시 뜨는 팝업창 내용 변경하기... [3] 2019.06.07 by goji
Azpi swiper.js 관련 질문드립니다 [10] file 2019.06.06 by JN87
punk embed 보이지않는 문제  
봄비 게시판 <사용자 정의> 소스 문의 [3] file 2019.06.06 by 봄비
봄비 리믹스1992 버전에서요. 포인트 깍히게 하는 요소 [2] 2019.06.06 by 봄비
Enki 크롬 ck에디터 먹통 [1] 2019.06.06 by DoorWeb
홈런볼11 서명 입력 부부을 textarea 변경하기 [1] 2019.06.06 by DoorWeb
jhc****06a74 고수님... 검색 부분에 엑스표가 표시되어 글씨가 모두 지워지게 부탁드립니다. [1] 2019.06.06 by DoorWeb
jhc****06a74 고수님께... 프로그램 수정 부탁드립니다.  
죽방망이 애드센스 웹뷰에서 안나오게 할려면?? [2] 2019.06.06 by 죽방망이
blue 사이트맵모듈 질문드립니다 file  
blue 슬라이드 없애는법 [5] 2019.06.05 by DoorWeb
lun**** 레이아웃 설정 복사 [4] 2019.06.05 by DoorWeb