여분필드의 데이터를 엑셀에서 불러오는 문의 드립니다.

엑셀에서 데이터 불러오는거 질문이요...ㅜㅜ

여기서 얻은 공부로 만들었는데요...데이터 불러오는데 문제가 생겼네요...



<?
$excel_down = "g4_write_" . $_GET['bo_table']; //엑셀 다운로드 테이블
$wr_id = $id = $_GET['wr_id'];

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"); // 한글깨지면 주석해지


if ($ms =="excel"){
$g4[title] = "엑셀 문서 다운로드";
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=상품구매.xls" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="power"){
$g4[title] = "파워포인트 문서 다운로드";
header( "Content-type: application/vnd.ms-powerpoint" );
header( "Content-Disposition: attachment; filename=상품구매.ppt" );
// header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="word"){
$g4[title] = "워드 문서 다운로드";
header( "Content-type: application/vnd.ms-word" );
header( "Content-Disposition: attachment; filename=상품구매.doc" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="memo"){
$g4[title] = "메모 문서 다운로드";
header( "Content-type: application/vnd.ms-notepad" );
header( "Content-Disposition: attachment; filename=상품구매.txt" );
} else {
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=상품구매.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=utf-8">
<style type="text/css">

.txt {mso-number-format:'\@'}
</style>
</head>

<body>
<table>
<tr>
<td>번호</td>
<td>반별</td>
<td>신상정보</td>
<td>주소</td>
</tr>

<?
while($data=mysql_fetch_array($result)) {
echo "
<tr>
<td>$number</td>
<td>$data[ca_name]</td>
<td class='txt'>$data[wr_4]</td>
<td class='txt'>$data[wr_3]</td>
</tr>
";
$number--;
}
?>
</table>
</body>
</html>

---------------------------------------------------------------------------------
이런 소스에서...

하단에...<td class='txt'>$data[wr_4]</td>... 이런식으로 데이타는 잘 불러 옵니다.

문제는...제가....여분필드에 있는 하위필드??

$ex4_filed = explode("|",$write[wr_4]);
$ext4_00 = $ex4_filed[0];
$ext4_01 = $ex4_filed[1];
$ext4_02 = $ex4_filed[2];

이런것들을 쓰거든요...

$ext4_00 요런 데이터를 끌고 와야 하는데 어떻게 불러와야 할지 모르겠네요...
wr_4를 적으면 저 데이타... 내용들이 다 끌려 와서...

다시 정리하자니 어렵고 해서 혹시 저 $ext4_00 와 같은 데이터를

<tr>
<td>$number</td>
<td>$data[ca_name]</td>
<td class='txt'>$data[wr_4]</td>
<td class='txt'>$data[wr_3]</td>
</tr>

여기에 넣을 수 없을까요???
|

댓글 2개

<?
while($data=mysql_fetch_array($result)) {

$ex4_filed = explode("|",$data[wr_4]);
$ext4_00 = $ex4_filed[0];
$ext4_01 = $ex4_filed[1];
$ext4_02 = $ex4_filed[2];

echo "
<tr>
<td>$number</td>
<td>$data[ca_name]</td>
<td class='txt'>$ext4_00</td>
<td class='txt'>$ext4_01</td>
<td class='txt'>$ext4_02</td>
<td class='txt'>$data[wr_3]</td>
</tr>
";
$number--;
}
?>
보니까 해피정님 파일이더라구요...감사합니다...
하나더 질문이요..^^
<td class='txt'>$ext4_01</td>
<td class='txt'>$ext4_02</td>
<td class='txt'>$ext4_03</td>

위 테이블이 전화번호입니다. 예를 들어 $ext4_01 이 '010' 이고 ext4_02 이 5235 ... 이런식으로 전화번호가 합쳐지는데..저렇게 따로 안쓰고...

<td class='txt'>$ext4_01 - $ext4_02 - $ext4_03 </td>

이런식으로 할수는 없을까요?
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
13년 전 조회 3,959
13년 전 조회 1,010
13년 전 조회 998
13년 전 조회 1,127
13년 전 조회 1,562
13년 전 조회 1,645
13년 전 조회 1,058
13년 전 조회 935
13년 전 조회 985
13년 전 조회 1,553
13년 전 조회 1,123
13년 전 조회 1,701
13년 전 조회 1,551
13년 전 조회 1,700
13년 전 조회 848
13년 전 조회 573
13년 전 조회 734
13년 전 조회 806
13년 전 조회 1,601
13년 전 조회 993