도와주세요
본문
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\apache\g5\adm\member_recommend.php on line 25
<?
$sub_menu = "200400";
include_once("./_common.php");
$sub_menu = "200400";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$token = get_token();
// 이전것을 모두 지우고 다시 입력한다.
sql_query(" drop table tmp_recommend ", FALSE);
// 테이블 생성 - 추천인현황 : 추천인(아이디,이름, level), 소속, 추천자이름과 아이디, level, 추천인 수
$sql = " CREATE TABLE tmp_recommend (
re_no int(11) NOT NULL auto_increment,
re_id varchar(255) NOT NULL default '',
re_member text NOT NULL default '',
re_num int(11)NOT NULL default '0',
PRIMARY KEY (re_no)
) TYPE=MyISAM ";
sql_query($sql, FALSE);
sql_query(" drop table tmp_recommend ", FALSE);
// 테이블 생성 - 추천인현황 : 추천인(아이디,이름, level), 소속, 추천자이름과 아이디, level, 추천인 수
$sql = " CREATE TABLE tmp_recommend (
re_no int(11) NOT NULL auto_increment,
re_id varchar(255) NOT NULL default '',
re_member text NOT NULL default '',
re_num int(11)NOT NULL default '0',
PRIMARY KEY (re_no)
) TYPE=MyISAM ";
sql_query($sql, FALSE);
$sql = " select * from g5_member order by mb_datetime desc";
$result = sql_query($sql);
if($result)
{
for ($i=0; $row=mysql_fetch_array($result); $i++) // 이부분 게속 오류가 뜨는데요 어덯게 하면 되나요 ????
{
// 추천인이 있는 회원 모두 출력 - 임시테이블에 추천인 있으면 업데이터 없으면 신규저장
$re_id = $row[mb_recommend]; // 추천인아이디
$re_member = $row[mb_name] ."(" .$row[mb_id] .") ";
$re_num = 1;
$result = sql_query($sql);
if($result)
{
for ($i=0; $row=mysql_fetch_array($result); $i++) // 이부분 게속 오류가 뜨는데요 어덯게 하면 되나요 ????
{
// 추천인이 있는 회원 모두 출력 - 임시테이블에 추천인 있으면 업데이터 없으면 신규저장
$re_id = $row[mb_recommend]; // 추천인아이디
$re_member = $row[mb_name] ."(" .$row[mb_id] .") ";
$re_num = 1;
if($re_id != ""){
$rem = get_tmp_recommend($re_id);
if(!$rem){
$re = " insert into tmp_recommend
set re_id = '$re_id',
re_member = '$re_member',
re_num = '$re_num' ";
sql_query($re);
$rem = get_tmp_recommend($re_id);
if(!$rem){
$re = " insert into tmp_recommend
set re_id = '$re_id',
re_member = '$re_member',
re_num = '$re_num' ";
sql_query($re);
}else{
$re_no = $rem[re_no];
$re_num = $rem[re_num] + 1;
$ck_num = $re_num % 5;
if($ck_num == 0){
$re_member = $rem[re_member] .$row[mb_name] ."(" .$row[mb_id] .")<br> ";
}else{
$re_member = $rem[re_member] .$row[mb_name] ."(" .$row[mb_id] .") ";
}
$sql_re = " re_member = '$re_member',
re_num = '$re_num' ";
$sql = " update tmp_recommend
set $sql_re
where re_no = '$re_no' ";
sql_query($sql);
}
}
}
}
$re_no = $rem[re_no];
$re_num = $rem[re_num] + 1;
$ck_num = $re_num % 5;
if($ck_num == 0){
$re_member = $rem[re_member] .$row[mb_name] ."(" .$row[mb_id] .")<br> ";
}else{
$re_member = $rem[re_member] .$row[mb_name] ."(" .$row[mb_id] .") ";
}
$sql_re = " re_member = '$re_member',
re_num = '$re_num' ";
$sql = " update tmp_recommend
set $sql_re
where re_no = '$re_no' ";
sql_query($sql);
}
}
}
}
//=========================================================================================================================//
$sql_common = " from tmp_recommend ";
$sql_search = " where (1) ";
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
default :
$sql_search .= " ($sfl like '$stx%') ";
break;
}
$sql_search .= " ) ";
}
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
default :
$sql_search .= " ($sfl like '$stx%') ";
break;
}
$sql_search .= " ) ";
}
$sql = " select count(*) as cnt
$sql_common
$sql_search
$sql_order ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$sql_common
$sql_search
$sql_order ";
$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; // 시작 열을 구함
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$listall = "<a href='$_SERVER[PHP_SELF]' class=tt>처음</a>";
$g5[title] = "추천인현황";
include_once("./admin.head.php");
include_once("./admin.head.php");
$sql = " select *
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
$colspan = 5;
?>
?>
<table width=100%>
<form name=fsearch method=get>
<tr>
<td width=50% align=left><?=$listall?> (총 추천인수 : <?=number_format($total_count)?>)</td>
<td width=50% align=right>
<select name=sfl class=cssfl>
<option value='re_name'>추천인 이름</option>
<option value='re_id'>추천인 아이디</option>
</select>
<input type=text name=stx class=ed required itemname='검색어' value='<? echo $stx ?>'>
<input type=image src='<?=$g5[admin_path]?>/img/btn_search.gif' align=absmiddle></td>
</tr>
</form>
</table>
<form name=fsearch method=get>
<tr>
<td width=50% align=left><?=$listall?> (총 추천인수 : <?=number_format($total_count)?>)</td>
<td width=50% align=right>
<select name=sfl class=cssfl>
<option value='re_name'>추천인 이름</option>
<option value='re_id'>추천인 아이디</option>
</select>
<input type=text name=stx class=ed required itemname='검색어' value='<? echo $stx ?>'>
<input type=image src='<?=$g5[admin_path]?>/img/btn_search.gif' align=absmiddle></td>
</tr>
</form>
</table>
<table width=100% cellpadding=0 cellspacing=0>
<colgroup width=60>
<colgroup width=80>
<colgroup width=60>
<colgroup width=''>
<colgroup width=60>
<colgroup width=60>
<colgroup width=80>
<colgroup width=60>
<colgroup width=''>
<colgroup width=60>
<tr><td colspan='<?=$colspan?>' class='line1'></td></tr>
<tr class='bgcol1 bold col1 ht center'>
<td><font color=CD7444>소속</font></td>
<td><?=subject_sort_link('re_name')?><font color=CD7444>추천인이름</font></a></td>
<td><font color=CD7444>레벨</font></td>
<td><font color=CD7444>추천회원명단</font></td>
<td><?=subject_sort_link('re_num')?><font color=CD7444>추천인 수</font></a></td>
</tr>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
<?
for ($i=0; $row=sql_fetch_array($result); $i++) {
$re_id = $row[re_id];
$mb = get_member($re_id); // 해당추천인정보 가져온다.
$re_level = $mb[mb_level];
if($re_level == 1){$level = "1";}
else if($re_level == 2){$level = "2";}
else if($re_level == 3){$level = "3";}
else if($re_level == 4){$level = "4";}
else if($re_level == 5){$level = "5";}
else if($re_level == 6){$level = "6";}
else if($re_level == 7){$level = "7";}
else if($re_level == 8){$level = "8";}
else if($re_level == 9){$level = "9";}
else if($re_level == 10){$level = "10";}
<tr class='bgcol1 bold col1 ht center'>
<td><font color=CD7444>소속</font></td>
<td><?=subject_sort_link('re_name')?><font color=CD7444>추천인이름</font></a></td>
<td><font color=CD7444>레벨</font></td>
<td><font color=CD7444>추천회원명단</font></td>
<td><?=subject_sort_link('re_num')?><font color=CD7444>추천인 수</font></a></td>
</tr>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
<?
for ($i=0; $row=sql_fetch_array($result); $i++) {
$re_id = $row[re_id];
$mb = get_member($re_id); // 해당추천인정보 가져온다.
$re_level = $mb[mb_level];
if($re_level == 1){$level = "1";}
else if($re_level == 2){$level = "2";}
else if($re_level == 3){$level = "3";}
else if($re_level == 4){$level = "4";}
else if($re_level == 5){$level = "5";}
else if($re_level == 6){$level = "6";}
else if($re_level == 7){$level = "7";}
else if($re_level == 8){$level = "8";}
else if($re_level == 9){$level = "9";}
else if($re_level == 10){$level = "10";}
$list = $i%2;
echo "
<tr height=30>
<td align='center'>$re_ar</td>
<td title='$row[re_id]' align='center'>$mb[mb_name]</td>
<td align='center'>$level</td>
<td>$row[re_member]</td>
<td align='center'>$row[re_num]</td>
</tr>";
}
echo "
<tr height=30>
<td align='center'>$re_ar</td>
<td title='$row[re_id]' align='center'>$mb[mb_name]</td>
<td align='center'>$level</td>
<td>$row[re_member]</td>
<td align='center'>$row[re_num]</td>
</tr>";
}
if ($i == 0)
echo "<tr><td colspan='$colspan' align=center height=100 class=contentbg>자료가 없습니다.</td></tr>";
echo "<tr><td colspan='$colspan' align=center height=100 class=contentbg>자료가 없습니다.</td></tr>";
echo "<tr><td colspan='$colspan' class='line2'></td></tr>";
echo "</table>";
echo "</table>";
$pagelist = get_paging($config[cf_write_pages], $page, $total_page, "?$qstr&page=");
echo "<table width=100% cellpadding=3 cellspacing=1>";
echo "<tr><td width=50%>";
echo "<input type=button class=btn1 value='추천인트리뷰' onclick=\"document.location.href='./member_re.php'\">";
echo "</td>";
echo "<td width=50% align=right>$pagelist</td></tr></table>\n";
echo "<table width=100% cellpadding=3 cellspacing=1>";
echo "<tr><td width=50%>";
echo "<input type=button class=btn1 value='추천인트리뷰' onclick=\"document.location.href='./member_re.php'\">";
echo "</td>";
echo "<td width=50% align=right>$pagelist</td></tr></table>\n";
if ($stx)
echo "<script language='javascript'>document.fsearch.sfl.value = '$sfl';</script>\n";
?>
echo "<script language='javascript'>document.fsearch.sfl.value = '$sfl';</script>\n";
?>
<script language="JavaScript">
function btn_re() {
win_open('./member_re.php', "recommend", "left=0, top=0, width=800, height=800, scrollbars=1");
}
function btn_report() {
win_open('./recommend_report.php', "recommend", "left=0, top=0, width=800, height=800, scrollbars=1");
}
</script>
<?
include_once ("./admin.tail.php");
?>
function btn_re() {
win_open('./member_re.php', "recommend", "left=0, top=0, width=800, height=800, scrollbars=1");
}
function btn_report() {
win_open('./recommend_report.php', "recommend", "left=0, top=0, width=800, height=800, scrollbars=1");
}
</script>
<?
include_once ("./admin.tail.php");
?>
답변을 작성하시기 전에 로그인 해주세요.