묻고답하기
회원정보 엑셀로 출력하는데, 정회원구분...
2012.02.03 14:50
회원정보를 엑셀로 출력하는데 확장변수 값들은 잘 나오는데,,,,
정회원인지 준회원인지를 그룹리스트 를 나오게 할려면 어떻게 해야하는지..........
<?
define('__ZBXE__',true);
require_once("./config/config.inc.php");
$oContext = &Context::getInstance();
$oContext->init(); $logged_info = Context::get('logged_info');
$isadmin = $logged_info->is_admin;
if($isadmin)
{
$connect_host = "localhost";
$connect_id = " ";
$connect_pass = " ";
$connect_db = " ";
$connect_table = "xe_member";
$xls_filename = "memberlist.xls";
$connect=@mysql_connect($connect_host,$connect_id,$connect_pass);
@mysql_query("set character set utf8");
$mysql=@mysql_select_db($connect_db,$connect);
}
else
{
@mysql_close($connect);
die();
}
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$xls_filename");
?>
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=UTF-8" />
</head>
<body>
<table border=1>
<tr align=center>
<?
$fields = mysql_list_fields("$connect_db", "$connect_table");
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++)
{
$field[$i]=mysql_field_name($fields, $i);
if($field[$i]=='extra_vars')
{
echo "<th>정회원구분</th>";
echo "<th>확장변수1</th>";
echo "<th>확장변수2</th>";
echo "<th>확장변수3</th>";
echo "<th>확장변수4</th>";
}
else
echo "<th>".$field[$i]. "</th>";
}
?>
</tr>
<?
$result=mysql_query("select * from $connect_table");
while($data=mysql_fetch_assoc($result)){ echo"<tr>";
for ($i = 0; $i < sizeof($field); $i++)
{
if($i==3) echo "<td></td>";
elseif($i==15)
{
$dstr=date("Y-m-d", ztime($data["$field[$i]"]));
echo "<td>".$dstr."</td>"; } elseif($i==16)
{
$dstr=date("Y-m-d", ztime($data["$field[$i]"]));
echo "<td>".$dstr."</td>";
}
elseif($i==22)
{
$ser = unserialize($data["$field[$i]"]);
echo "<td>".$ser->그룹리스트."</td>"; //이곳에 정회원인지, 준회원인지,, 그룹리스트명이 나오게할려고하는데 안돼요...
echo "<td>".$ser->확장변수1."</td>";
echo "<td>".$ser->확장변수2."</td>";
echo "<td>".$ser->확장변수3."</td>";
echo "<td>".$ser->확장변수4."</td>";
}
elseif($i==20)
{
$dstr=date("Y-m-d", ztime($data["$field[$i]"]));
echo "<td>".$dstr."</td>";
}
else echo "<td>".$data["$field[$i]"]."</td>";
}
echo"</tr>";
}
?>
</table>
</body>
</html>
xe_member 테이블에는 회원을 구분할 수 있는 칼럼이 없습니다.
그래서
테이블 join을 해야 할 겁니다.
참고 테이블 : xe_member_group_member