묻고답하기

안녕하세요?

아무래도 해결이 나지 않아 문의드립니다.

모든 값은 정상적으로 기입했는데요, mysql 명령어 오류가 자꾸 나길래 mysqli로 바꾸어서 실행해도 정상적인 동작을 하지 않습니다.

mariadb 10을 사용중인 것 같고요, 아래와 같이 변환해서 오류가 나는데 어떻게 처리해야할까요 ㅠㅠ

 

<?php
//url 로 직접 불러오는것을 방지
 //if(!strstr($_SERVER['HTTP_REFERER'],$_SERVER['SERVER_NAME'])&& !strstr($_SERVER['HTTP_REFERER'],'out_excel.php')) exit;
 
$info = array(
"host" => "localhost",
"user" => "**",
"pass" => "**",
"db" => "**",
"table" => "xe_documents",
"module_srl" => "**",
);
$getFields = array("title","regdate","content"); //출력원하는 칼럼을 배열로 입력
 
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=doc_".date('Ymd').".xls");

$con = mysqli_connect($info[host], $info[user], $info[pass]) || die(mysqli_error());
$con_db = mysqli_select_db($con, $info[db]) || die(mysqli_error());
mysqli_query($con, "set names utf8");
?>
 
<!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 = mysqli_list_fields("$info[db]", "$info[table]");
$columns = mysqli_num_fields($fields);
 
for( $i=0 ; $i<$columns ; $i++ )
{
    $field[$i]=mysqli_field_name($fields, $i);
    if( in_array($field[$i], $getFields) ) echo "<th>".$field[$i]."</th>";
}
 
//확장변수의 타이틀은 값이므로       
$result = mysqli_query("select  var_name from xe_document_extra_keys where module_srl = $info[module_srl]");                  
while( $data = mysqli_fetch_array($result) )
{                          
    echo "<th>".htmlspecialchars($data[var_name])."</th>";
}  
 
echo"</tr>";             
 
 
//데이터 불러오기
$result = mysqli_query("select * from $info[table] where module_srl = $info[module_srl]");
while( $data = mysqli_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=mysqli_query("select eid from xe_document_extra_keys where module_srl = $info[module_srl]");      
                while($extra_title=mysqli_fetch_array($query))
                {      
                    echo"<td>";
 
                    $egetFields = array("value","eid");  
                    //확장변수 값을 불러와 eid값이 같은곳에 출력
                    $extra_result = mysqli_query("select * from xe_document_extra_vars where document_srl = $d_srl");  
                    while( $edata = mysqli_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 남기남
우랑탕탕이 최근글 기본스킨 댓글수 표시 방법이뭔가요 ...? [1] file 2017.03.23 by 제이와이엔소프트
컴박살 addon(에드온 제작) 문의 드립니다.  
노사 디자인을 꾸밀수가없네요..안보입니다..페이지가 [1] file 2017.03.22 by J__
잡학쟁이 wiris 컨포넌트를 사용하고 있는데 HTML 소스 일부가 잘라먹고 저장됩니다.  
바다7ee2b 게시판 어드민 계정이 오류 납니다. [1] 2017.03.22 by 너에게제공
정세영 네이버 검색결과 어떻게 나오게 할 수 있을까요? [2] file 2017.03.22 by 너에게제공
주방이모 index.php?mid=현재페이지&act=dispBoardWrite로 하려면 어떻게 해야하나요? [3] 2017.03.22 by BRANDYK
zartin 이 프로그램 없나요? [1] file 2017.03.22 by BRANDYK
jforgood 회원정보보기 페이지를 수정? 별도로 만들려는데 ...? [2] file 2017.03.22 by jforgood
미연조 게시판 검색 기능을 다른 페이지에 별도로 만들고 싶습니다.ㅠㅠ 도와주세요. [2] 2017.03.22 by 미연조
menestrello 백업복원시 일부 데이터가 복원되지 않습니다.  
실속제로 SweetMobile 레이아웃 설정이 궁금한데요. [1] file 2017.03.22 by 실속제로
anyonediver sketchbook5 게시판 상단 홈버튼 질문입니다. [2] file 2017.03.21 by anyonediver
nick 홈페이지 백업 복구 [1] 2017.03.21 by J__
하늘감성 새글 이메일 알림 [2] 2017.03.21 by 불꽃남자cc4e1
991050 게시판 사진 첨부하면 상단에 슬라이드 배너 생성 [1] file 2017.03.21 by J__
닉네임설정한시간째 회원가입 폼에 국가와 지역을 선택하는 항목을 넣고 싶은데요.. [3] file 2017.03.21 by J__
Ashleya9757 비밀댓글이 자꾸 보여요ㅠㅠㅠㅠ도와주세요....ㅠㅠㅠ  
미연조 xe 게시판 list.html 파일 말고 write_form.html 파일 먼저 읽게하는 방법 [2] 2017.03.21 by 미연조
늘같이 RSS 읽어오기가 안됩니다. ㅜㅜ  
없음04177 스케치북5 게시판 스킨! 재질문 드립니다. [2] file 2017.03.21 by 991050
토분위 경고창 문구 수정 [1] file 2017.03.21 by sejin7940
xelomero 단일선택 확장변수를 위젯으로 출력시 array 출력문제 [6] 2017.03.21 by xelomero
라부쓰 게시글 출력시 일부분만 공개하고 싶어요  
lark007 메타태그 부분이 {Context::getHtmlHeader()} 로 되 있는데 어느 파일에 있는지요?  
지천 이미 존재하는 모듈 안내 관련 [2] 2017.03.21 by 건즈
new_usein 메인화면 문구 바꾸는 방법!! [1] file 2017.03.20 by 개tothe미
개tothe미 댓글 작성시에도 RSS 동작하도록 하는 방법  
yang**** 게시판 글 엑셀로 가져오기 오류... [1] 2017.03.20 by sejin7940
에소르 위젯을 생성하여 내용직접추가를 하니... [1] 2017.03.20 by 제이와이엔소프트