묻고답하기

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

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 남기남
Masterhwan 홈페이지 스킨을 변경 했습니다 [1] 2019.03.06 by DoorWeb
KimJ 글쓰기 본문에 iframe 필터링 문제 질문 [6] file 2019.03.06 by KimJ
마하수리 카페24 PHP 버전 변경 방법 [6] 2019.03.06 by 마하수리
찌우닝 닷홈에서 웹호스팅 XE회사테마 문의합니다.. [2] 2019.03.06 by 찌우닝
디씨넷 글쓰기 화면 에러문구 어떻게 없애나요? [4] file 2019.03.05 by 디씨넷
sitara 댓글이 있는지 없는지 어떻게 아나요? [6] 2019.03.05 by sitara
앤더슨 첨부파일 사이즈를 늘리고 싶어요 ㅠ [4] file 2019.03.05 by 앤더슨
앤더슨 첨부파일 사이즈 변경 해결했습니다.  
검은내일 cafe24 서브도메인 질문입니다 [1] 2019.03.05 by LuisK
sitara if문 좀 가르쳐주세요 ㅠㅠ [2] 2019.03.05 by sitara
chorok contact board skin 에서 개인정보취급방침 동의서 출력 [5] file 2019.03.04 by DoorWeb
wtst 스케치북5 list.html에 내용추가하고싶습니다 [2] file 2019.03.04 by wtst
디씨넷 카카오스토리에 링크방식으로 글을 올리면... file  
chorok 스케치북 게시판 스킨 에디터 박스(?)가 서로 다른 이유?? [4] file 2019.03.03 by chorok
우랑탕탕이 Contact 게시판스킨, 모바일 스킨 이거 안되는 분들 [2] 2019.03.03 by chorok
V6DS 홈페이지 오류 - 깨짐현상 [2] file 2019.03.03 by V6DS
sitara 스케치북 글보호 기능 오류 메세지 관련 file  
추기헌 로그인 오류 [1] 2019.03.03 by sejin7940
V6DS 갤러리에 올린 사진들이 회전이 되어 있어요... [2] 2019.03.02 by V6DS
구름의저편 마이그레이션 질문입니다  
Genoss 위젯 크기가 변경 되지 않습니다 [6] 2019.03.02 by Genoss
펀고리 xe3 설치 오류 [2] 2019.03.02 by 펀고리
HTML왕초보 도와주세요!! 클릭 한번으로 창 두개를 띄우고 싶어요 [2] 2019.03.01 by HTML왕초보
검은고양이냐옹 php 확장 필수 모듈 설치 봐주실 수 있을까요? [2] 2019.03.01 by 검은고양이냐옹
sitara 요청한 기능을 실행할 수 있는 권한이 없습니다 페이지 어딨나요? [2] 2019.02.28 by sitara
현님v XEDITION 배경색 문의드립니다. [2] file 2019.02.28 by 우랑탕탕이
불꽃남자cc4e1 메일 발송/발송자 이메일 [1] 2019.02.28 by 불꽃남자cc4e1
코딩펀 로그인 창의 텍스트 박스에 노란색 음영이 나오는 이유는 [1] file 2019.02.28 by DoorWeb
검은고양이냐옹 내부 아이피로 XE 사이트 구축 할 수 있나요? [2] 2019.02.27 by 검은고양이냐옹
sitara 사용자정의 폼 관련 [2] 2019.02.27 by sitara