회원 리스트 출력 관련,,
본문
<?
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=file.xls");
header("Content-Description: PHP4 Generated Data");
include "./_common.php";
if($_POST['chk']) {
$k = implode(", ", $_POST['chk']);
$where = "where mb_id = '{$_POST['mb_id'][$k]}'";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
#table { width:90%; }
#table th { height:30px; padding:8px; background:#ddd; }
#table td { padding:5px; text-align:left;}
</style>
</head>
<body>
<table border="1" id="table">
<tr>
<th>No.</th>
<th>이름</th>
<th>별명</th>
<th>아이디</th>
<th>소속</th>
<th>회원분류</th>
<th>가입일</th>
<th>메일링</th>
</tr>
<?
$que = sql_query("SELECT * FROM {$g5['member_table']} ".$where);
for ($j=1; $row = sql_fetch_array($que); $j++) {
?>
<tr>
<td><?=$j?></td>
<td><?=$row['mb_name']?></td>
<td><?=$row['mb_nick']?></td>
<td><?=$row['mb_id']?></td>
<td><?=$row['mb_1']?></td>
<td><?=$row['mb_2']?></td>
<td><?=$row['mb_datetime']?></td>
<td><? if ($row['mb_mailling'] == "1") { ?><font color="#ff0066">허용</font><? } else { ?>거부<? } ?></td>
</tr>
<?
}
?>
</table>
</body>
</html>
현재..관리자에서 회원 엑셀 다운로드를 사용중인데요..
현재 전체목록 과 한개씩 체크햇을 때는 엑셀로 다운이 잘 되는데
2개 이상 중복으로 체크를 하면... 공백으로 나오는데..
아무래도..
if($_POST['chk']) {
$k = implode(", ", $_POST['chk']);
$where = "where mb_id = '{$_POST['mb_id'][$k]}'";
}
여기서 어떻게 수정을 해줘야 될까요..
!-->!-->
답변 1
if($_POST['chk']) {
$arr = array();
foreach($_POST['chk'] as $k) {
$arr[] = $_POST['mb_id'][$k];
}
$where = 'where mb_id in ("'.implode('","', $arr).'") ';
}
이렇게 함 해보시죠.
!-->
답변을 작성하시기 전에 로그인 해주세요.