묻고답하기

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

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 남기남
키미마루 Xe 스타터인데 자작 레이아웃 디자인이 가능한가요? [3] 2019.02.19 by 키미마루
키미즈 개시판의 첨부파일이 다운되지 않습니다 [4] file 2019.02.19 by 키미즈
김민석 모바일 로 접속시 화면이 1도 안보이고 흰색화면이 보여요 [1] 2019.02.18 by DoorWeb
일그리고여행 SQL 쿼리 문장 .. 도움을 부탁드립니다. [2] 2019.02.18 by 일그리고여행
paraduxx 미리보기를 하면 html 이 그대로 나오는데  
rail_man 회원목록에서 관리자를 삭제하였습니다. [2] 2019.02.17 by rail_man
roks821 파일첨부동작?  
모던웹 첨부파일 자동본문삽입 안되게 할수는 없나요? [2] 2019.02.16 by orangehome
railman 이메일 인증시 오류가 발생하였습니다. file  
지나 게시판에 글 쓰고 등록 클릭하면 그대로 있네요... [2] 2019.02.15 by 지나
soyum**** php)다운로드 파일이 제대로 안보이는 오류 [2] file 2019.02.15 by soyum****
CtrlV 외부페이지 DB 불러오기가 왜 안될까요? [2] 2019.02.15 by CtrlV
inhyeparklee 설정>게시판정보>고급>'섬네일' 추가해도 저장하면 목록에서 사라짐 +썸네일 가려짐 file  
함형규 안녕하세요.. 도움 주실분..구합니다.. [1] 2019.02.14 by LuisK
T1000 메인 페이지에서 사진을 꽉 채우려고 하려면 [2] 2019.02.12 by T1000
꿀잠자요 잘못된 응답을 전송했습니다. 라고 뜹니다. [1] 2019.02.12 by LuisK
꿀잠자요 XE 사용 초보입니다. 로그인 오류로 아얘 접속이 안됩니다. [4] 2019.02.12 by 꿀잠자요
railman 홈페이지에서 상담신청 게시판을 만들고자 합니다. [1] 2019.02.12 by LuisK
김세환 XEDITION 레이아웃 모바일 로그인창 질문드립니다 [1] file 2019.02.11 by DoorWeb
야호딩동댕 스켓치북 모듈스킨 본문 버튼 수정 부탁드립니다. [2] file 2019.02.11 by 야호딩동댕
shoothing**** 스케치북5 게시판 체크박스 질문 좀 드릴께요 [4] 2019.02.10 by shoothing****
inhyeparklee 원본글 복사를 했는데, 댓글은 없네요. 댓글은 복사가 안되나요? [2] 2019.02.09 by inhyeparklee
삼무 홈페이지에 회원 가입하려는데 웹 페이지 미시지가 자꾸 떠는 것은 어떻게 헤야 하나요 [2] file 2019.02.09 by 삼무
크림스푸 코어 업로드 후 글자깨짐 [4] file 2019.02.09 by inhyeparklee
inhyeparklee 특정한 게시물만 깨지는 현상(+게시판 전체 글 깨짐) file  
정주신 웹페이지를 긁어온후 그값을 위젯으로 올릴수 없나요? [1] 2019.02.09 by 정주신
㉿반딧불 [zeroboard4] 한번 봐 주십시요. [1] 2019.02.08 by DoorWeb
날제비 홈페이지 추가 수정관련 문의 드립니다. [2] file 2019.02.08 by DoorWeb
shoothing**** 스케치북5 관리자 로그인시 체크박스가 안보여요 [3] file 2019.02.08 by sejin7940
david 웹사이트에 올려진 사진들이 나타나지 않습니다. [2] file 2019.02.08 by david