묻고답하기

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

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 남기남
별빛 본문 내에서 조회수 삭제를 하고 싶습니다. [9] file 2019.01.22 by LuisK
리천 조인 OR 서브쿼리 도움좀 부탁드려요~~  
rail_man BJ람보님 출석부 업데이트후 HTTP 500 내부 서버 오류... [1] 2019.01.21 by rail_man
별빛 최고 관리자 숨기기 할 수 있나요? [12] file 2019.01.21 by 별빛
핑크이구아나 XE 사용 중인데 어느순간부터 댓글 수정 및 삭제가 되지 않습니다. [1] 2019.01.21 by LuisK
벼리 기간별로 작성글 수 작성댓글을 구하려면 어떻게 해야할까요? [1] 2019.01.21 by LuisK
dd**** 글삭제 권한에 대하여 문의드려요. [1] 2019.01.21 by LuisK
리천 관리자 댓글 출력 수정 위치좀 알려주세요 [2] 2019.01.21 by 리천
오감 게시글 추천/비추천/신고가 안됩니다... [7] 2019.01.21 by 오감
코딩펀 게시판에서 <ul> <li> 태그가 안 먹히는 이유? [3] 2019.01.21 by 코딩펀
이건희 사이트맵 백지 현상 일어나네요 file  
디트리히A <load target="..."/> 관련 파일 경로가 어떻게 될까요?  
forgood 게시판 글에 아이디별 접근 권한 부여하기? [2] 2019.01.19 by sejin7940
allpcpc 게시판 사용자 정의를 너무 길게 넣었더니말이죠.. [1] 2019.01.19 by allpcpc
바키라 모바일에서 서 레이아웃 비정상 문의드려요  
알렉스서 메인, 즉 인텍스는 어디에 있나요? [2] 2019.01.18 by LuisK
anajo7 로그인과 관리자 페이지 오류(도와 주세요) [1] file 2019.01.18 by LuisK
xowl**** 설치된레이아웃 >기본레이아웃>메인레이아웃>설정후 이미지등록이안되요 ㅠ [1] 2019.01.17 by LuisK
풀발잡기 로그인 오류 [1] 2019.01.17 by 디자인클립
Bera 어느 순간부터 유튜브 링크를 걸었을 때 동영상이 자동으로 안뜨네요ㅠ [6] 2019.01.16 by Happiness
도토리묵 포인트 부족시 알림창 띄우기  
콜롬보 다른 회원정보 보기 권한 [4] 2019.01.16 by 콜롬보
오감 게시글에 댓글이 달릴시 이메일로 알람이 오게 하는 방법이 있을까요? [2] 2019.01.16 by 오감
댑펑 게시물 대량 이동을 DB 명령어로 가능한가요? [1] 2019.01.15 by sejin7940
별빛 특정그룹이나 회원에게 회원정보수정권한 주게 할 수 있나요? [3] 2019.01.15 by sejin7940
Happiness xe 1.11.2 로 업글후 로그인 안됩니다.  
밀가루 http 500 error 문제 [6] 2019.01.15 by 밀가루
totus**** 레이아웃 메뉴 수정하는 법? [4] file 2019.01.15 by totus****
davinchi121 xe 로컬로 설정하는 법 좀 알려주세요 [1] 2019.01.15 by LuisK
홈런볼11 게시글 내 특수문자 [1] 2019.01.15 by LuisK