묻고답하기

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

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 남기남
세걸 쉬운설치가 안됩니다. [3] 2019.04.01 by 세걸
GSJ 레이아웃에서 변경 후 로그인이랑 검색이 안보여요ㅠㅠ  
ILMARE 첨부파일 확장자 소문자로 자동변환방법이 궁굼합니다  
손주사랑 new post에게시판 제목 나오게하는 방법좀 부탁 드립니다 file  
Spooky 모바일에서만 '권한이 없습니다'가 나오는 이유가 궁금합니다. [1] 2019.03.29 by Spooky
우주 새글 표시 모듈이 작동하지 않습니다. file  
숲지기 자동으로 \(원표시)가 입력되면서 레이아웃이 초기화됩니다. [1] 2019.03.29 by 숲지기
세걸 조회수 표시& 검색문제 [2] 2019.03.29 by 세걸
마이산 판매자 연락처 보기 변경 file  
피피 팝업창이 뜨질 않습니다.  
기가 네이버로 접속하여 로그인시 에러 [2] 2019.03.28 by 기가
rail_man 섬네일 비율을 "크롭"으로 설정하였음에도 원본비율로 노출됩니다.  
웅쿠미 달력모듈 게시판 사용시 첫 화면 [2] file 2019.03.27 by 웅쿠미
김인호 엮인글 문의 드립니다. [6] 2019.03.27 by sejin7940
테란 xe 스킨 복사방법 [2] 2019.03.27 by 테란
가츠 모바일 도메인(cafe24) 사용시 로그인오류 현상 [1] 2019.03.26 by DoorWeb
herrwook 개인 서버에 그간 사진을 한꺼번에 올리려는데요...  
-f99d7 회원가입시 실명 인증 시스템 [1] 2019.03.26 by sejin7940
어거지 게시글을 등급별로 볼수 있을까요? [1] 2019.03.26 by 디자인클립
dkexpress 화면 왼쪽에 있는 링크 주소를 바꿔야 하는데.... 첨이라 잘 모르겠네요..... 도와 주세요.  
개발자티케 사이트메뉴편집에서 메뉴가 안나옵니다. [7] file 2019.03.25 by 이원희884
forgnhan 에라가 이렇게 뜹니다.  
qweasdz**** 게시판 관련 [2] file 2019.03.25 by qweasdz****
아놔진짜 특정 게시판 글쓰기시 특정 bash 스크립트 실행 방법?  
fasflpelqwe 위키모듈을 사용하고 싶은데 오류가 납니다. 도와주세요.. [1] 2019.03.25 by sejin7940
headkim 메인화면 꾸미기 [1] 2019.03.25 by DoorWeb
가츠 머티어리얼 XE 레이아웃 문제점 질문요.  
칠월 스팸회원 전체 삭제- 혹은 회원정보 제외하고 게시글만 백업 하는 방법이 있을까요? [1] 2019.03.24 by EDragon
incation 아 왜 이렇게 잘 안됨? [1] 2019.03.24 by EDragon
미주 모바일에서 링크한 트위터 출력 방법