확장 여분필드 엑셀 출력 문의 정보
확장 여분필드 엑셀 출력 문의본문
다른값들은 엑셀 출력이 전혀 문제가 없는데
여분필드를 쪼개서 확장여분필드로 쓴 경우에 따로 항목을 엑셀로 뽑아야 하는데
아예 빈값으로만 저장됩니다.
사용한 코드는 아래와 같습니다.
어디가 잘못된건지 당췌 모르겠네요.
사용한 여분필드--------------------------------------------------------------
$ex6_filed = explode("|",$view[wr_6]);
$ext6_00 = $ex6_filed[0];
$ext6_01 = $ex6_filed[1];
$ext6_02 = $ex6_filed[2];
$ext6_03 = $ex6_filed[3];
$ext6_04 = $ex6_filed[4];
$ext6_05 = $ex6_filed[5];
$ext6_06 = $ex6_filed[6];
$ext6_07 = $ex6_filed[7];
$ext6_08 = $ex6_filed[8];
$ext6_09 = $ex6_filed[9];
excel.php -----------------------------------------------------------------------------
<?
$excel_down = "g4_write_" . $_GET['bo_table']; //엑셀 다운로드 테이블
$wr_id = $id = $_GET['wr_id'];
$ex_data = explode("|",$row[wr_6]);
include "../../../dbconfig.php";
$db_conn = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die('서버에 접속하지 못했습니다.');
mysql_select_db($mysql_db, $db_conn);
//@mysql_query("SET CHARACTER SET utf8"); // 한글깨지면 주석해지
$today = date("Y-m-d");
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=다운로드_". $today. ".xls");
header( "Content-Description: PHP4 Generated Data" );
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down ")); //where wr_is_comment = '0' and wr_content = '$wr_id' "));
$result=@mysql_query("select * from $excel_down order by wr_datetime desc");// where wr_is_comment = '0' and wr_content = '$wr_id' order by wr_datetime desc");
$number=$temp[0];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<style type="text/css">
.txt {mso-number-format:'\@'}
</style>
</head>
<body>
<table>
<?
while($data=mysql_fetch_array($result)) {
echo "
<tr>
<td>$number</td>
<td class='txt'>$data[wr_datetime]</td>
<td>$data[wr_subject]</td>
<td>$data[wr_name]</td>
<td class='txt'>$ex_data[1]</td>
<td class='txt'>$ex_data[2]</td>
<td class='txt'>$ex_data[5]</td>
<td class='txt'>$ex_data[8]</td>
<td class='txt'>$ex_data[9]</td>
</tr>
";
$number--;
}
?>
</table>
</body>
</html>
여분필드를 쪼개서 확장여분필드로 쓴 경우에 따로 항목을 엑셀로 뽑아야 하는데
아예 빈값으로만 저장됩니다.
사용한 코드는 아래와 같습니다.
어디가 잘못된건지 당췌 모르겠네요.
사용한 여분필드--------------------------------------------------------------
$ex6_filed = explode("|",$view[wr_6]);
$ext6_00 = $ex6_filed[0];
$ext6_01 = $ex6_filed[1];
$ext6_02 = $ex6_filed[2];
$ext6_03 = $ex6_filed[3];
$ext6_04 = $ex6_filed[4];
$ext6_05 = $ex6_filed[5];
$ext6_06 = $ex6_filed[6];
$ext6_07 = $ex6_filed[7];
$ext6_08 = $ex6_filed[8];
$ext6_09 = $ex6_filed[9];
excel.php -----------------------------------------------------------------------------
<?
$excel_down = "g4_write_" . $_GET['bo_table']; //엑셀 다운로드 테이블
$wr_id = $id = $_GET['wr_id'];
$ex_data = explode("|",$row[wr_6]);
include "../../../dbconfig.php";
$db_conn = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die('서버에 접속하지 못했습니다.');
mysql_select_db($mysql_db, $db_conn);
//@mysql_query("SET CHARACTER SET utf8"); // 한글깨지면 주석해지
$today = date("Y-m-d");
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=다운로드_". $today. ".xls");
header( "Content-Description: PHP4 Generated Data" );
$temp=mysql_fetch_array(mysql_query("select count(*) from $excel_down ")); //where wr_is_comment = '0' and wr_content = '$wr_id' "));
$result=@mysql_query("select * from $excel_down order by wr_datetime desc");// where wr_is_comment = '0' and wr_content = '$wr_id' order by wr_datetime desc");
$number=$temp[0];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<style type="text/css">
.txt {mso-number-format:'\@'}
</style>
</head>
<body>
<table>
<?
while($data=mysql_fetch_array($result)) {
echo "
<tr>
<td>$number</td>
<td class='txt'>$data[wr_datetime]</td>
<td>$data[wr_subject]</td>
<td>$data[wr_name]</td>
<td class='txt'>$ex_data[1]</td>
<td class='txt'>$ex_data[2]</td>
<td class='txt'>$ex_data[5]</td>
<td class='txt'>$ex_data[8]</td>
<td class='txt'>$ex_data[9]</td>
</tr>
";
$number--;
}
?>
</table>
</body>
</html>
댓글 전체
while($data=mysql_fetch_array($result)) {
$ex_data = explode("|",$data[wr_6]);///추가
ech "....
이렇게 되야 하지 않나요?
$ex_data = explode("|",$data[wr_6]);///추가
ech "....
이렇게 되야 하지 않나요?
정말 감사합니다.
덕분에 바로 해결되서 햄볶고 있습니다.
덕분에 바로 해결되서 햄볶고 있습니다.