팝업창 관리자 오류 채택완료
루트에 pop 폴더와 wedit폴더를 업로드후에 dbconn.php 파일을 db계정으로 바꾼후 팝업 관리자를
접속했습니다. 아래와 같은 문구가 뜨더라고여
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /free/home/kingman/html/pop/index.php on line 98
Copy
# 총 갯수 구하기 / $Total = mysql_fetch_array(mysql_query("select count(no) as no from popup ".$SEQ." ", $dbconn)); $TotalNum = $Total[0]; # / 총 갯수 구하기
98라인은 total 로 시작하는 부분입니다.
팝업 갯수만 구하는 함수인것 같은데.. 팝업창 등록도 되지 않고 난감합니다.
총 갯수 구하는 함수가 잘못되어서 등록조차 안되는 걸까요??
꼭 알려주세요.
혹시 몰라 팝업 index파일 올려드립니다.
Copy
<?include "_common.php"; //그누연동시include_once "./header.php";if($member[mb_level]==10) //그누로그인연동{ // 팝업 로그인이 되어 있으면
function search_css($fetch, $q) { if($q) return str_replace($q, "<span class=\"sv\">".$q."</span>", $fetch); else return $fetch; }
function date_parser($date) { // date { 20110101 } $Year = substr($date,0,4); $Month = substr($date,4,2); $Day = substr($date,6,2); return $Year.".".$Month.".".$Day;
}
if(!$page) { $page=1; } if(!$limit) { $limit=20;} if(!$row_list) { $row_list=10;} $first = $limit*($page-1); $last = $limit*$page; $no = $total_record - $first; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> <meta http-equiv="content-type" content="text/html; charset=euc-kr"> <title>팝업프로그램</title> <meta http-equiv="content-type" content="text/html; charset=euc-kr"> <meta http-equiv="Cache-Control" content="no-cache" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /> <link rel="stylesheet" href="./style/style.css" type="text/css" />
<script language="javascript"> function popup_sw(no, sw) { switch(sw) { case "1": val = "활성"; break; default : val = "비활성"; break; }
if(confirm("팝업을 "+val+" 할까요?")) { location.href="./save.php?no="+no+"&check=popup&sw="+sw+"&page=<?=$page?>"; } } </script> </head> <body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<table border="0" cellpadding="0" cellspacing="0"> <tr> <td> <span style="font-weight:bold; font-size:15px;"> 팝업관리자</span> </td> <!--<td style="padding:8px 0 0 40px; font-weight:bold;"> 관리자님께서 로그인하셨습니다. <a href="./login.php">[로그아웃]</a> </td>--> </tr> </table> <hr size="1" color="#c4c4c4">
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff" width="100%"> <thead> <tr> <td class="table_thead" width="3%">번호</td> <td class="table_thead" width="5%">팝업종류</td> <td class="table_thead" width="10%">팝업이름</td> <td class="table_thead" width="7%">사이즈</td> <td class="table_thead" width="10%">여백</td> <td class="table_thead" width="5%">등록방법</td> <td class="table_thead" width="10%">팝업기간</td> <td class="table_thead" width="5%">등록일</td> <td class="table_thead" width="5%">활성</td>
</tr> </thead> <tbody> <? # 검색 쿼리 부분 / $SEQ = ""; if($_GET['q']) { $SEQ .= " where popup_name like '%".$_GET['q']."%' "; } else { $SEQ .= ""; } # / 검색 쿼리 부분
# 총 갯수 구하기 / $Total = mysql_fetch_array(mysql_query("select count(no) as no from popup ".$SEQ." ", $dbconn)); $TotalNum = $Total[0]; # / 총 갯수 구하기
# 내용이 등록되어 있으면 / if($TotalNum>0) { $Query = mysql_query("select * from popup ".$SEQ." order by no desc limit $first, $limit", $dbconn) or die("ProductLoadQuery error"); if ($page>1) { $NumPrint = $TotalNum - $first; } else { $NumPrint = $TotalNum; } $NumPrint = $NumPrint + 1; $i=0; while($i<$limit && $Fetch = mysql_fetch_array($Query)) { $NumPrint = $NumPrint - 1; if($Fetch['sw'] == "1") { $bg = 'ffffff';} else { $bg = 'dedede';} ?> <tr align="center"> <td class="table_tbody<?=$bg?>" style="background-color:#<?=$bg?>;"><?=$NumPrint?></td> <td class="table_tbody<?=$bg?>" style="background-color:#<?=$bg?>;"><a href="./write.php?no=<?=$Fetch['no']?>&page=<?=$page?>"><?=$Fetch['class']?></a></td> <td class="table_tbody<?=$bg?>" style="background-color:#<?=$bg?>;"><a href="./write.php?no=<?=$Fetch['no']?>&page=<?=$page?>"><?=$Fetch['popup_name']?></a></td> <td class="table_tbody<?=$bg?>" style="background-color:#<?=$bg?>;"><?=$Fetch['width']."x".$Fetch['height']?></td> <td class="table_tbody<?=$bg?>" style="background-color:#<?=$bg?>;"><?=$Fetch['tops']."/".$Fetch['lefts']?></td> <td class="table_tbody<?=$bg?>" style="background-color:#<?=$bg?>;"><?=$Fetch['add_type']?></td> <td class="table_tbody<?=$bg?>" style="background-color:#<?=$bg?>;"><?=date_parser($Fetch['sdate'])."~".date_parser($Fetch['edate'])?></td> <td class="table_tbody<?=$bg?>" style="background-color:#<?=$bg?>;"><?=str_replace("-", ".", substr($Fetch['date'],0,10))?></td> <td class="table_tbody<?=$bg?>" style="background-color:#<?=$bg?>;"> <? switch($Fetch['sw']) { case("1"): // 활성 (팝업을 이용함) ?> <a href="javascript:popup_sw('<?=$Fetch['no']?>', '0');">이용중</a> <? break; default: // 비활성 (이용하지 않음) ?> <a href="javascript:popup_sw('<?=$Fetch['no']?>', '1');">이용안함</a> <? break; } ?> </td> </tr>
<tr><td colspan="9" height="1" bgcolor="#dedede"></td></tr> <? $i++; } } else { ?> <tr> <td colspan="9" align="center" bgcolor="#ffffff"> <? if($_GET['q']) print "<b>'".$_GET['q']."'</b> (으)로 검색된 정보가 없습니다"; else print "등록된 정보가 없습니다"; ?> </td> </tr> <tr><td colspan="9" height="1" bgcolor="#eeeeee"></td></tr> <? } # / 내용이 등록되어 있으면 ?> </tbody> </table>
<!-- 쪽번호의 시작 --> <table border="0" cellpadding="0" cellspacing="0" align="center" summary="쪽 번호를 시작합니다"> <caption>리스트 번호</caption> <tbody> <tr> <? $total_page = ceil($TotalNum/$limit); $total_block = ceil($total_page/$row_list); $block = ceil($page/$row_list); $first_page=($block-1)*$row_list; $last_page=$block*$row_list; $prev = $first_page; $next = $last_page+1; $go_page = $first_page+1; if($total_block <= $block) {$last_page=$total_page;} ?> <?if($block > 1) {?> <td style="padding:10px 6px 0 6px"><a href="<?=$PHP_SELF?>?page=1&limit=<?=$limit?>">처음페이지</a> ... </td> <td style="padding:10px 5px 0 0px"><a href="<?=$PHP_SELF?>?page=<?=$_GET['prev']?>&limit=<?=$limit?>">이전10개</a></td> <?}?> <?for($go_page; $go_page <= $last_page; $go_page++){ ?> <?if($page == $go_page) {?> <td style="padding:10px 6px 0 6px"><span class="select_page_number"><?=$go_page?></span></td> <?} else {?> <td style="padding:10px 6px 0 6px"><a href="<?=$PHP_SELF?>?page=<?=$go_page?>&limit=<?=$limit?>"><?=$go_page?></a></td> <?}?> <?}?> <?if($block < $total_block){?> <td style="padding:10px 0 0 5px"><a href="<?=$PHP_SELF?>?page=<?=$next?>&limit=<?=$limit?>">다음10개</a></td> <td style="padding:10px 6px 0 6px"> ... <a href="<?=$PHP_SELF?>?page=<?=$total_page?>&limit=<?=$limit?>" >마지막페이지</a> </td> <?}?> </tr> </tbody> </table> <!--/ 쪽번호의 끝 -->
<!-- 검색 및 등록 폼 --> <table border="0" cellpadding="0" cellspacing="0"> <form action="" method="get"> <tr>
<td class="search"><input type="text" name="q" value="<?=$_GET['q']?>"></td> <td class="search"><input type="submit" value="검색"></td> </form> <td class="search"><input type="button" value="등록" onclick="location.href='./write.php'"></td> <? if($_GET['q']) { ?> <td class="search"><input type="button" value="검색종료" onclick="location.href='./index.php'"></td> <? } ?> </tr></table> <!-- 검색 및 등록 폼 -->
<!-- <a href="javascript:allDeleteForm()">선택삭제</a> -->
<div style="padding:20px 0 0 0; text-align:center;"> <hr size="1" color="#c4c4c4"> Copyright © <a href="http://webic.co.kr" target="_blank" style="text-decoration:underliner;">webic.co.kr</a>. All rights reserved. </div>
</body> </html><?} // 팝업 로그인이 되어 있으면else{?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> <meta http-equiv="content-type" content="text/html; charset=euc-kr"> <title>분석</title> <meta http-equiv="content-type" content="text/html; charset=euc-kr"> <meta http-equiv="Cache-Control" content="no-cache" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /> <link rel="stylesheet" href="./style/style.css" type="text/css" /> <script language="javascript"> function _login_() { if(!document.login.id.value) { alert("아이디를 입력하십시오. "); document.login.id.focus(); return false; } if(!document.login.pw.value) { alert("비밀번호를 입력하십시오. "); document.login.pw.focus(); return false; } document.login.action = "login.php"; document.login.method="post"; } </script> </head> <body>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"> <tr> <td align="center">
<table border="0" cellpadding="5" cellspacing="0" width="400"> <tr> <td align="center"> <span style="font-weight:bold; font-size:15px;"> 팝업관리자</span> <hr size="1" color="#c4c4c4" width="400"> </td> </tr>
<tr> <td align="center" style="padding:20px 0 0 0;">
<form name="login" onsubmit="return _login_()"> <table border="0" cellpadding="4" cellspacing="0"> <tr> <td style="font-family:'돋움';font-size:12px;" align="right">아이디: </td> <td><input type="text" name="id" style="width:150px;"></td> </tr> <tr> <td style="font-family:'돋움';font-size:12px;" align="right">비밀번호 :</td> <td><input type="password" name="pw" style="width:150px;"></td> </tr>
<tr> <td></td> <td><input type="submit" value="로그인"></td> </tr>
<table> </form>
</td> </tr>
<tr><td align="center" style="font-size:12px; font-familt:돋움;padding:20px 0 0 0;"> <hr size="1" color="#c4c4c4" width="400"> Copyright © <a href="http://webic.co.kr" target="_blank" style="text-decoration:underliner;">webic.co.kr</a>. All rights reserved. </td></tr>
</table> </td> </tr> </table>
</body> </html><?}include_once "./footer.php";?>
답변 1개
10년 전
소스가 문제가 아니라 DB 에 table 가있는가를 확인하고 거기에 no ㅣㄹ드가 인는가를 확인하시는것이 우선
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인