말씀해 주신대로 하면 $num 이 전부 2가 찍힙니다; 주문내역이 2개거든요;
밑에는 소스입니다
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!defined("_ORDERINQUIRY_")) exit; // 개별 페이지 접근 불가
// 테마에 orderinquiry.sub.php 있으면 include
if(defined('G5_THEME_SHOP_PATH')) {
$theme_inquiry_file = G5_THEME_SHOP_PATH.'/orderinquiry.sub.php';
if(is_file($theme_inquiry_file)) {
include_once($theme_inquiry_file);
return;
unset($theme_inquiry_file);
}
}
?>
<!-- 주문 내역 목록 시작 { -->
<?php if (!$limit) { ?>총 <?php echo $cnt; ?> 건<?php } ?>
<div class="tbl_head01 tbl_wrap">
<table>
<thead>
<tr>
<th scope="col">번호</th>
<th scope="col">주문번호</th>
<th scope="col">상품명</th>
<th scope="col">주문일시</th>
<th scope="col">상품수</th>
<th scope="col">주문금액</th>
<th scope="col">입금액</th>
<th scope="col">미입금액</th>
<th scope="col">상태</th>
</tr>
</thead>
<tbody>
<?php
/* 원본
$sql = " SELECT *
FROM {$g5['g5_shop_order_table']}
WHERE mb_id = '{$member['mb_id']}'
ORDER BY od_id DESC
$limit ";
*/
$sql = " SELECT *
FROM {$g5['g5_shop_order_table']} a
INNER JOIN {$g5['g5_shop_cart_table']} b ON
a.od_id = b.od_id
LEFT JOIN {$g5['g5_shop_item_table']} c ON
b.it_id = c.it_id
WHERE b.mb_id = '{$member['mb_id']}'
ORDER BY a.od_id DESC
$limit ";
$result = sql_query($sql);
$num = $total_count - ($page - 1) * $rows;
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$image = get_it_image($row['it_id'], 70, 70);
$uid = md5($row['od_id'].$row['od_time'].$row['od_ip']);
switch($row['od_status']) {
case '주문':
$od_status = '입금확인중';
break;
case '입금':
$od_status = '입금완료';
break;
case '준비':
$od_status = '상품준비중';
break;
case '배송':
$od_status = '상품배송';
break;
case '완료':
$od_status = '배송완료';
break;
default:
$od_status = '주문취소';
break;
}
print_r ($row);
?>
<tr>
<td><?php echo $num; ?></td>
<td><?php echo $image.$row['it_name'].$row['it_option_subject'].$row['it_supply_subject']; ?></td>
<td>
<input type="hidden" name="ct_id[<?php echo $i; ?>]" value="<?php echo $row['ct_id']; ?>">
<a href="<?php echo G5_SHOP_URL; ?>/orderinquiryview.php?od_id=<?php echo $row['od_id']; ?>&uid=<?php echo $uid; ?>"><?php echo $row['od_id']; ?></a>
</td>
<td><?php echo substr($row['od_time'],2,14); ?> (<?php echo get_yoil($row['od_time']); ?>)</td>
<td class="td_num"><?php echo $row['od_cart_count']; ?></td>
<td class="td_numbig"><?php echo display_price($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
<td class="td_numbig"><?php echo display_price($row['od_receipt_price']); ?></td>
<td class="td_numbig"><?php echo display_price($row['od_misu']); ?></td>
<td><?php echo $od_status; ?></td>
</tr>
<?php
}
$num--;
if ($i == 0)
echo '<tr><td colspan="8" class="empty_table">주문 내역이 없습니다.</td></tr>';
?>
</tbody>
</table>
</div>
<!-- } 주문 내역 목록 끝 -->