쇼핑몰만드는데 입금 구매내역페이지 질문입니다 정보
쇼핑몰만드는데 입금 구매내역페이지 질문입니다본문
밑에 sql문 보시면 그냥 아이디로 찾아서 쭉 나오게 되어있는데
이걸 해당 아이디에 po_rel_table이 b10인 것만 골라서 리스트를 뽑고싶습니다...
po_rel_table은 물론 point_table 안에 있는 테이블입니다...
sql문을 어떻게 수정해야하나요?
<?
include_once("./_common.php");
include_once("../_head.php");
if (!$member[mb_id])
alert("회원만 조회하실 수 있습니다.");
$g4[title] = $member[mb_nick] . "님의 포인트 내역";
include_once("$g4[path]/head.sub.php");
$list = array();
$sql_common = " from $g4[point_table] where mb_id = '$member[mb_id]' ";
$sql_order = " order by po_id desc ";
$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_page_rows];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$width = "971";
?>
<style type="text/css">
.field {border:1px solid #555;background:#40403B;color:white;padding-top:2px;}
.board_list{table-layout:fixed;border:1px #555 solid;}
.board_list th{height:27px;padding-top:3px;color:white;background:url("../../../img/BOARDLIST_HEAD.gif");}
.board_list .left{padding:0;}
.board_list th{letter-spacing:-1;}
.board_list .list0{background:#FFF;}
.board_list .list1{background:#f7f7f7;}
.paginate { padding:6px 0; text-align:center;}
.paginate *{ margin:0; padding:0;}
.paginate a,.paginate strong{ _position:relative; margin-left:-9px; font-weight:bold; display:inline-block; padding:3px 8px 1px 7px; color:white; border-left:1px solid #555; border-right:1px solid #555; text-decoration:none; line-height:normal; font:bold 12px 굴림, Gulim, 돋움, Dotum, AppleGothic, Sans-serif; background:#000;}
.paginate strong{ color:#575C76 !important;}
.paginate a:hover{ background:#3F4C6B; }
.paginate a.pre{ padding:3px 8px 1px 16px; background:url("") no-repeat 8px 6px !important; border:none; font-weight:normal; }
.paginate a.pre_end{ padding:3px 8px 1px 16px; background:url("") no-repeat 4px 6px !important; border:none; border-right:1px solid #555; font-weight:normal;}
.paginate a.next{ padding:3px 16px 1px 8px; background:url("") no-repeat 37px 6px !important; border:none; font-weight:normal; }
.paginate a.next_end{ padding:3px 16px 1px 8px; background:url("") no-repeat 37px 6px !important; border:none; border-left:1px solid #555; font-weight:normal;}
</style>
<table width="<?=$width?>" height="50" border="0" cellpadding="5" cellspacing="0" align=center bgcolor="111111">
<tr>
<td align="center" valign="middle">
<table width="100%" height="40" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="500" align="left">사용내역</td>
<td align="right">*보유금액 : <B><?=number_format($member[mb_point])?> 점</B></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="<?=$width?>" height="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="200" align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="2" bgcolor="222222"></td>
</tr>
<tr>
<td>
<table width=100% cellpadding=5 cellspacing=0 border=0 bgcolor="111111" class="board_list">
<tr align=center>
<th width="130" height="24"><b>일시</b></th>
<th width=""><b>내용</b></th>
<th width="100"><b>입금내역</b></th>
<th width="100"><b>사용내역</b></th>
</tr>
<?
$sum_point1 = $sum_point2 = 0;
$sql = " select *
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$point1 = $point2 = 0;
if ($row[po_point] > 0) {
$point1 = "+" . number_format($row[po_point]);
$sum_point1 += $row[po_point];
} else {
$point2 = number_format($row[po_point]);
$sum_point2 += $row[po_point];
}
echo <<<HEREDOC
<tr height="25" align="center">
<td height="24">$row[po_datetime]</td>
<td align="left" title='$row[po_content]'><nobr style='display:block; overflow:hidden; width:550px;'> $row[po_content]</a></td>
<td align="right">{$point1}</td>
<td align="right">{$point2}</td>
</tr>
<tr><td height="1" bgcolor="555555" colspan="4"></td></tr>
HEREDOC;
}
if ($i == 0)
echo "<tr><td colspan=4 align=center height=100>자료가 없습니다.</td></tr>";
else {
if ($sum_point1 > 0)
$sum_point1 = "+" . number_format($sum_point1);
$sum_point2 = number_format($sum_point2);
echo <<<HEREDOC
<tr height=25 bgcolor="555555" align="center">
<td height="24" colspan=2 align=center>소계</td>
<td align=right>{$sum_point1}</td>
<td align=right>{$sum_point2}</td>
</tr>
HEREDOC;
}
?>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="30" align="center"><div class="paginate"><?=get_paging($config[cf_write_pages], $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&page=");?></div></td>
</tr>
</table>
<?
include_once("$g4[path]/tail.sub.php");
include_once("../_tail.php");
?>
이걸 해당 아이디에 po_rel_table이 b10인 것만 골라서 리스트를 뽑고싶습니다...
po_rel_table은 물론 point_table 안에 있는 테이블입니다...
sql문을 어떻게 수정해야하나요?
<?
include_once("./_common.php");
include_once("../_head.php");
if (!$member[mb_id])
alert("회원만 조회하실 수 있습니다.");
$g4[title] = $member[mb_nick] . "님의 포인트 내역";
include_once("$g4[path]/head.sub.php");
$list = array();
$sql_common = " from $g4[point_table] where mb_id = '$member[mb_id]' ";
$sql_order = " order by po_id desc ";
$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_page_rows];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$width = "971";
?>
<style type="text/css">
.field {border:1px solid #555;background:#40403B;color:white;padding-top:2px;}
.board_list{table-layout:fixed;border:1px #555 solid;}
.board_list th{height:27px;padding-top:3px;color:white;background:url("../../../img/BOARDLIST_HEAD.gif");}
.board_list .left{padding:0;}
.board_list th{letter-spacing:-1;}
.board_list .list0{background:#FFF;}
.board_list .list1{background:#f7f7f7;}
.paginate { padding:6px 0; text-align:center;}
.paginate *{ margin:0; padding:0;}
.paginate a,.paginate strong{ _position:relative; margin-left:-9px; font-weight:bold; display:inline-block; padding:3px 8px 1px 7px; color:white; border-left:1px solid #555; border-right:1px solid #555; text-decoration:none; line-height:normal; font:bold 12px 굴림, Gulim, 돋움, Dotum, AppleGothic, Sans-serif; background:#000;}
.paginate strong{ color:#575C76 !important;}
.paginate a:hover{ background:#3F4C6B; }
.paginate a.pre{ padding:3px 8px 1px 16px; background:url("") no-repeat 8px 6px !important; border:none; font-weight:normal; }
.paginate a.pre_end{ padding:3px 8px 1px 16px; background:url("") no-repeat 4px 6px !important; border:none; border-right:1px solid #555; font-weight:normal;}
.paginate a.next{ padding:3px 16px 1px 8px; background:url("") no-repeat 37px 6px !important; border:none; font-weight:normal; }
.paginate a.next_end{ padding:3px 16px 1px 8px; background:url("") no-repeat 37px 6px !important; border:none; border-left:1px solid #555; font-weight:normal;}
</style>
<table width="<?=$width?>" height="50" border="0" cellpadding="5" cellspacing="0" align=center bgcolor="111111">
<tr>
<td align="center" valign="middle">
<table width="100%" height="40" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="500" align="left">사용내역</td>
<td align="right">*보유금액 : <B><?=number_format($member[mb_point])?> 점</B></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="<?=$width?>" height="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="200" align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="2" bgcolor="222222"></td>
</tr>
<tr>
<td>
<table width=100% cellpadding=5 cellspacing=0 border=0 bgcolor="111111" class="board_list">
<tr align=center>
<th width="130" height="24"><b>일시</b></th>
<th width=""><b>내용</b></th>
<th width="100"><b>입금내역</b></th>
<th width="100"><b>사용내역</b></th>
</tr>
<?
$sum_point1 = $sum_point2 = 0;
$sql = " select *
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$point1 = $point2 = 0;
if ($row[po_point] > 0) {
$point1 = "+" . number_format($row[po_point]);
$sum_point1 += $row[po_point];
} else {
$point2 = number_format($row[po_point]);
$sum_point2 += $row[po_point];
}
echo <<<HEREDOC
<tr height="25" align="center">
<td height="24">$row[po_datetime]</td>
<td align="left" title='$row[po_content]'><nobr style='display:block; overflow:hidden; width:550px;'> $row[po_content]</a></td>
<td align="right">{$point1}</td>
<td align="right">{$point2}</td>
</tr>
<tr><td height="1" bgcolor="555555" colspan="4"></td></tr>
HEREDOC;
}
if ($i == 0)
echo "<tr><td colspan=4 align=center height=100>자료가 없습니다.</td></tr>";
else {
if ($sum_point1 > 0)
$sum_point1 = "+" . number_format($sum_point1);
$sum_point2 = number_format($sum_point2);
echo <<<HEREDOC
<tr height=25 bgcolor="555555" align="center">
<td height="24" colspan=2 align=center>소계</td>
<td align=right>{$sum_point1}</td>
<td align=right>{$sum_point2}</td>
</tr>
HEREDOC;
}
?>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="30" align="center"><div class="paginate"><?=get_paging($config[cf_write_pages], $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&page=");?></div></td>
</tr>
</table>
<?
include_once("$g4[path]/tail.sub.php");
include_once("../_tail.php");
?>
댓글 전체

$sql_common = " from $g4[point_table] where mb_id = '$member[mb_id]' and $po_rel_table = 'b10' ";
$sql_order = " order by po_id desc ";
$sql = " select count(*) as cnt $sql_common ";
이 처럼 하면 않될까요? ^^
뭐 아는게 없다보니....쩝..;;;;;
$sql_order = " order by po_id desc ";
$sql = " select count(*) as cnt $sql_common ";
이 처럼 하면 않될까요? ^^
뭐 아는게 없다보니....쩝..;;;;;