리스트 번호 표현 문의 드립니다. 정보
리스트 번호 표현 문의 드립니다.본문
활용팁 중 회원검색 페이지 소스 입니다.
검색된 회원이 나열될때 맨앞에 번호를 나타나게 하고싶은데..
그냥 게시판에서 사용하는 {$list[$i][num]} 는 안되네요...
####### 이곳에 번호 표현 ####### 이렇게 표시한곳에 순차적으로 증가하는 번호 표현 도와주세요.
<?
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
$g4['title'] = "";
include_once("./_head.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if ($sname) {
switch ($sfl) {
case "ug_id" : $search_sql = " ug_id like '%$sname%' ";
$order_sql = " order by mb_nick"; break;
case "mb_nick" : $search_sql = " mb_nick like '%$sname%' ";
$order_sql = " order by mb_nick"; break;
case "mb_name" : $search_sql = " mb_name like '%$sname%' ";
$order_sql = " order by mb_name"; break;
case "mb_id" : $search_sql = " mb_id like '%$sname%' ";
$order_sql = " order by mb_id"; break;
case "mb_all" : $search_sql = " mb_nick like '%$sname%' or mb_id like '%$sname%' or ug_id like '%$sname%' or mb_name like '%$sname%' ";
$order_sql = " order by mb_id"; break;
default : $search_sql = " 1 ";
}
$sql = " select count(*) as cnt from $g4[member_table] where ( mb_leave_date = '' and mb_nick != '[삭제됨]' ) and ( $search_sql ) ";
$result = sql_fetch($sql);
$total_count = $result[cnt];
$one_rows = 18; // 한페이지의 라인수
$total_page = ceil($total_count / $one_rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $one_rows; // 시작 열을 구함
$to_record = $from_record + $one_rows ;
$sql = " select * from $g4[member_table] where ( mb_leave_date = '' and mb_nick != '[삭제됨]' )and ( $search_sql ) $order_sql limit $from_record, $one_rows";
$result = sql_query($sql);
$search_count = mysql_num_rows($result);
if ($search_count > 0) {
for ($i=0; $row=mysql_fetch_array($result); $i++) {
$list[$i]->id = "$row[mb_id]";
$list[$i]->name = $row[mb_name];
$list[$i]->nick = $row[mb_nick];
$list[$i]->gi = $row[ug_id];
$list[$i]->ban = $row[mb_1];
$list[$i]->email = $row[mb_email];
$list[$i]->mb_open = $row[mb_open];
}
} else {
alert("찾으시는 회원정보가 없습니다.");
}
mysql_free_result($result);
}
$g4[title] = "회원 검색";
include_once("$g4[path]/head.sub.php");
?>
<style type="text/css">
<!--
.style5 {color: #333333;
font-weight: bold;
}
-->
</style>
<table width=650 border=0 cellspacing=0 cellpadding=0 align=center height=100>
<form name=frmid method=get autocomplete=off>
<input type=hidden name=frm_name value='<?=$frm_name?>'>
<input type=hidden name=ss_id value='<?=$ss_id?>'>
<tr>
<td align=center>
<select name=sfl>
<option value='mb_all'>통합검색</option>
<option value='ug_id'>그룹</option>
<option value='mb_name'>이름</option>
<option value='mb_nick'>별명</option>
<option value='mb_id'>아이디</option>
</select>
<input type=text name=sname value='<?=$sname?>' required minlength=2 itemname='회원이름' size=24> <input type=image src='img/search.gif' border=0 align=absmiddle></td>
</tr>
</table>
<!-- 검색결과 여기서부터 -->
<script type="text/javascript">
document.frmid.sname.focus();
</script>
<? if ($search_count > 0) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td>
<td>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td height=23 valign=top colspan=2><b>총 <?=$total_count?>명</b>의 동문을 찾았습니다.</td>
</tr>
</table>
<table width=100% cellpadding=0 cellspacing=0>
<colgroup width="100">
</colgroup>
<colgroup width="">
</colgroup>
<colgroup width="50">
</colgroup>
<tr>
<td height=2 align="center" bgcolor="d9d9d9" colspan=6></td>
</tr>
<tr>
<td width=10 height=30 bgcolor=efefef>번호</td>
<td bgcolor=efefef align=center width=130>이름</td>
<td bgcolor=efefef align=center width=130>아이디</td>
<td bgcolor=efefef align=center width=130>별명</td>
<td bgcolor=efefef align=center width=200>E-mail</td>
<td bgcolor=efefef align=center>정보보기</td>
</tr>
<tr>
<td height=2 align="center" bgcolor="d9d9d9" colspan=6></td>
</tr>
<?
for ($i=0; $i<count($list); $i++)
{
echo "
<tr>
<td width=10 height=30>####### 이곳에 번호 표현 #######</td> <=<=<=<=<=<=<=<=<=<= 여기요
<td align=center width=130>
{$list[$i]->name}
</td>
<td align=center width=130>
{$list[$i]->id}
</td>
<td align=center width=130>
{$list[$i]->nick}
</td>
<td align=center width=200>
{$list[$i]->email}
</td>";
if ($list[$i]->mb_open == 1)
$msg = "<a href=\"javascript:;\" onclick=\"win_profile('" . $list[$i]->id . "')\">정보보기</a>";
else
$msg = "비공개";
echo "
<td align=center>{$msg}</td>";
echo "
</tr>
<tr><td height=1 bgcolor=b4c9dd colspan=6></td></tr>\n";
}
?>
<tr>
</table>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td height=10 align="center"></td>
</tr>
<tr>
<td>
<?
$page = get_paging($config[cf_write_pages], $page, $total_page, "?frm_name=$frm_name&ss_id=$ss_id&sname=$sname&sfl=$sfl&page=");
echo "$page";
?>
</td>
</tr>
<tr>
<td height=10 align="center"></td>
</tr>
</table>
<td width="20">
</tr></form>
</table>
<? } ?>
<script type="text/javascript">
if ('<?=$sfl?>') document.frmid.sfl.value = '<?=$sfl?>';
function setid(sname, sid)
{
var ov = top.opener.document.<?=$frm_name?>.<?=$ss_id?>.value;
var of = top.opener.document.<?=$frm_name?>.<?=$ss_id?>;
// if(ov.length>0) {
of.value = (sid);
// }else{
// of.value = sid;
// }
top.opener.focus();
top.close();
return false;
}
</script>
<?
include_once("./_tail.php");
?>
검색된 회원이 나열될때 맨앞에 번호를 나타나게 하고싶은데..
그냥 게시판에서 사용하는 {$list[$i][num]} 는 안되네요...
####### 이곳에 번호 표현 ####### 이렇게 표시한곳에 순차적으로 증가하는 번호 표현 도와주세요.
<?
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
$g4['title'] = "";
include_once("./_head.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if ($sname) {
switch ($sfl) {
case "ug_id" : $search_sql = " ug_id like '%$sname%' ";
$order_sql = " order by mb_nick"; break;
case "mb_nick" : $search_sql = " mb_nick like '%$sname%' ";
$order_sql = " order by mb_nick"; break;
case "mb_name" : $search_sql = " mb_name like '%$sname%' ";
$order_sql = " order by mb_name"; break;
case "mb_id" : $search_sql = " mb_id like '%$sname%' ";
$order_sql = " order by mb_id"; break;
case "mb_all" : $search_sql = " mb_nick like '%$sname%' or mb_id like '%$sname%' or ug_id like '%$sname%' or mb_name like '%$sname%' ";
$order_sql = " order by mb_id"; break;
default : $search_sql = " 1 ";
}
$sql = " select count(*) as cnt from $g4[member_table] where ( mb_leave_date = '' and mb_nick != '[삭제됨]' ) and ( $search_sql ) ";
$result = sql_fetch($sql);
$total_count = $result[cnt];
$one_rows = 18; // 한페이지의 라인수
$total_page = ceil($total_count / $one_rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $one_rows; // 시작 열을 구함
$to_record = $from_record + $one_rows ;
$sql = " select * from $g4[member_table] where ( mb_leave_date = '' and mb_nick != '[삭제됨]' )and ( $search_sql ) $order_sql limit $from_record, $one_rows";
$result = sql_query($sql);
$search_count = mysql_num_rows($result);
if ($search_count > 0) {
for ($i=0; $row=mysql_fetch_array($result); $i++) {
$list[$i]->id = "$row[mb_id]";
$list[$i]->name = $row[mb_name];
$list[$i]->nick = $row[mb_nick];
$list[$i]->gi = $row[ug_id];
$list[$i]->ban = $row[mb_1];
$list[$i]->email = $row[mb_email];
$list[$i]->mb_open = $row[mb_open];
}
} else {
alert("찾으시는 회원정보가 없습니다.");
}
mysql_free_result($result);
}
$g4[title] = "회원 검색";
include_once("$g4[path]/head.sub.php");
?>
<style type="text/css">
<!--
.style5 {color: #333333;
font-weight: bold;
}
-->
</style>
<table width=650 border=0 cellspacing=0 cellpadding=0 align=center height=100>
<form name=frmid method=get autocomplete=off>
<input type=hidden name=frm_name value='<?=$frm_name?>'>
<input type=hidden name=ss_id value='<?=$ss_id?>'>
<tr>
<td align=center>
<select name=sfl>
<option value='mb_all'>통합검색</option>
<option value='ug_id'>그룹</option>
<option value='mb_name'>이름</option>
<option value='mb_nick'>별명</option>
<option value='mb_id'>아이디</option>
</select>
<input type=text name=sname value='<?=$sname?>' required minlength=2 itemname='회원이름' size=24> <input type=image src='img/search.gif' border=0 align=absmiddle></td>
</tr>
</table>
<!-- 검색결과 여기서부터 -->
<script type="text/javascript">
document.frmid.sname.focus();
</script>
<? if ($search_count > 0) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td>
<td>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td height=23 valign=top colspan=2><b>총 <?=$total_count?>명</b>의 동문을 찾았습니다.</td>
</tr>
</table>
<table width=100% cellpadding=0 cellspacing=0>
<colgroup width="100">
</colgroup>
<colgroup width="">
</colgroup>
<colgroup width="50">
</colgroup>
<tr>
<td height=2 align="center" bgcolor="d9d9d9" colspan=6></td>
</tr>
<tr>
<td width=10 height=30 bgcolor=efefef>번호</td>
<td bgcolor=efefef align=center width=130>이름</td>
<td bgcolor=efefef align=center width=130>아이디</td>
<td bgcolor=efefef align=center width=130>별명</td>
<td bgcolor=efefef align=center width=200>E-mail</td>
<td bgcolor=efefef align=center>정보보기</td>
</tr>
<tr>
<td height=2 align="center" bgcolor="d9d9d9" colspan=6></td>
</tr>
<?
for ($i=0; $i<count($list); $i++)
{
echo "
<tr>
<td width=10 height=30>####### 이곳에 번호 표현 #######</td> <=<=<=<=<=<=<=<=<=<= 여기요
<td align=center width=130>
{$list[$i]->name}
</td>
<td align=center width=130>
{$list[$i]->id}
</td>
<td align=center width=130>
{$list[$i]->nick}
</td>
<td align=center width=200>
{$list[$i]->email}
</td>";
if ($list[$i]->mb_open == 1)
$msg = "<a href=\"javascript:;\" onclick=\"win_profile('" . $list[$i]->id . "')\">정보보기</a>";
else
$msg = "비공개";
echo "
<td align=center>{$msg}</td>";
echo "
</tr>
<tr><td height=1 bgcolor=b4c9dd colspan=6></td></tr>\n";
}
?>
<tr>
</table>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td height=10 align="center"></td>
</tr>
<tr>
<td>
<?
$page = get_paging($config[cf_write_pages], $page, $total_page, "?frm_name=$frm_name&ss_id=$ss_id&sname=$sname&sfl=$sfl&page=");
echo "$page";
?>
</td>
</tr>
<tr>
<td height=10 align="center"></td>
</tr>
</table>
<td width="20">
</tr></form>
</table>
<? } ?>
<script type="text/javascript">
if ('<?=$sfl?>') document.frmid.sfl.value = '<?=$sfl?>';
function setid(sname, sid)
{
var ov = top.opener.document.<?=$frm_name?>.<?=$ss_id?>.value;
var of = top.opener.document.<?=$frm_name?>.<?=$ss_id?>;
// if(ov.length>0) {
of.value = (sid);
// }else{
// of.value = sid;
// }
top.opener.focus();
top.close();
return false;
}
</script>
<?
include_once("./_tail.php");
?>
댓글 전체
for ($i=0; $i<count($list); $i++)
{
$list_no=(($page - 1) * $one_rows) + $i + 1;
echo "
<tr>
<td width=10 height=30>$list_no</td>
해보세요^^
{
$list_no=(($page - 1) * $one_rows) + $i + 1;
echo "
<tr>
<td width=10 height=30>$list_no</td>
해보세요^^
해결했습니다. 정확한 답변 감사드립니다 ^^