묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
이 에러가 머예요??
2003.07.15 21:32
$total=mysql_num_rows($result); <- 이게 자꾸 에러가 나요.. 무슨뜻인지도 모르겠고요..ㅠ_ㅠ
에러 내용 : Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:apm_setupusersboardboardlist.php on line 11
<?
session_start();
include("./include/config.php");
include("./include/style.php");
$connect=mysql_connect("localhost","root","12345");
mysql_select_db("board",$connect);
$result = mysql_query("select * from $board order by re desc, tts", $connect);
$total=mysql_num_rows($result);
$page_max=15;
$page_total=ceil($total/$page_max);
$count_total=($page_num-1)*$page_max;
$uncounter=$total-(($page_num-1)*$page_max);
if(!$total) {
echo("
<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=euc-kr>
<title>Untitled Document</title>
$style
</head>
<table width=640 bordercolor=white border=0 cellspacing=2 cellpadding=0 align=center>
<tr>
<td colspan=5 align=right height=20 bgcolor=#8CBEF7><font size=2>
<a href=boardwritei.php> 글쓰기 </a></font>
</td>
</tr>
</table>
</body>
</html>
");
}else{
echo("
<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=euc-kr>
<title>Untitled Document</title>
$style
</head>
<body bgcolor=#f4f4f4>
<table width=640 border=0 cellspacing=0 cellpadding=0 align=left>
<tr>
<td colspan=4 width=50 nowrap bgcolor=#f4f4f4 height=18 align=left>
<font size=2 color=#00008C>$total</font>
</td>
<td colspan=1 width=50 nowrap bgcolor=#f4f4f4 height=18 align=center>
<font size=2 color=#00008C>$page_num / $page_total</font>
</td>
</tr>
<tr>
<td width=640 nowrap colspan=5 bgcolor=#8CBEF7 height=20 align=center>
<font size=4 color=white><b>Blue Free Board_1.0</b></font>
</td>
</tr>
<tr>
<td width=50 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> NUM</font>
</td>
<td width=440 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> TITLE</font>
</td>
<td width=50 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> NAME</font>
</td>
<td width=50 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> DATE</font>
</td>
<td width=50 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> HIT</font>
</td>
</tr>
");
$day=mktime();
$today=date('m/d',$day);
$new="<font color=#FF5F55><sup>NEW</sup></font>";
$nbsp=" ";
for($i=0; $i<$page_max&$count_total<$total;) {
$num=mysql_result($result, $count_total ,"num");
$re=mysql_result($result, $count_total ,"re");
$subject=mysql_result($result, $count_total ,"subject");
$subject=stripslashes($subject);
$subject =substr("$subject",0,64);
$email=mysql_result($result,$count_total ,"email");
$name=mysql_result($result, $count_total ,"name");
$name =substr("$name",0,8);
$date=mysql_result($result, $count_total ,"date");
$click=mysql_result($result, $count_total ,"click");
$tts=mysql_result($result, $count_total, "tts");
$str=strlen($tts);
$tmp=time();
echo("
<tr bgcolor=#F0F8FF onMouseOver=this.style.backgroundColor='#DEF5FA' onMouseOut=this.style.backgroundColor=''>
<td nowrap height=18 align=center>
<font size=2 color=#444444>
");
if($UserID == $sessioncode) {
if($UserLOGINID=="admin"){
echo("<a href=boarddelete.php?num=$num&page_num=$page_num&re=$re&tts=$tts>$uncounter</a>");
}else{
echo("$uncounter");
}
}
echo("
</font>
</td>
<td nowrap height=18 align=left>
<font size=2 color=#444444>
<a href=boardread.php?num=$num&page_num=$page_num&click=$click>
");
for($j=1;$j<$str;$j++){
echo("$nbsp");
}
$k=1;
if($k<$str){
echo("↘");
}
echo("
${subject}
");
if($today==$date){
echo("$new");
}
echo("
</a></font>
</td>
<td nowrap height=18 align=center>
<font size=2 color=#444444>
$name</font>
</td>
<td nowrap height=18 align=center>
<font size=2 color=#444444>$date</font>
</td>
<td nowrap height=18 align=center>
<font size=2 color=#444444>$click</font>
</td>
</tr>
<tr>
<td colspan=5 bgcolor=#C8E0FF height=1></td>
</tr>
");
$i++;
$count_total++;
$uncounter=$uncounter-1;
}
echo("
<tr>
<td colspan=5 align=center height=18 bgcolor=#C8E0FF><font size=2>
");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////블럭지정 페이지 출력구문/////////////////////////////////////////////////////////////////////
$page_block=5; //페이지번호출력개수
$total_page=ceil($page_total/$page_block); //총페이지수/페이지번호출력개수3개
$block=ceil($page_num/$page_block); //현재페이지/페이지번호출력개수
$first=($block-1)*$page_block; //시작페이지번호
$end=$block*$page_block; //마지막페이지번호
if($block >=$total_page){
$end=$page_total;
}
if($block >1){
$page=$first-($page_block-1);
echo("
<b><a href=boardlist.php?page_num=$page> [이전 5]</a></b>
");
}else{
echo("[이전 5]");
}
for($p_num=$first+1; $p_num <= $end; $p_num++){
if($p_num==$page_num){
echo("<b>[$p_num]</b>");
}else{
echo("<a href=boardlist.php?page_num=$p_num>[$p_num]</a>");
}
}
if($block < $total_page){
$page=$end+1;
echo("
<b><a href=boardlist.php?page_num=$page> [다음 5]</a></b>
");
}else{
echo("[다음 5]");
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo("
</font>
</td>
</tr>
<tr>
<td colspan=4 align=left height=20 bgcolor=#8CBEF7>
<!--
<form method=post action=boardsearch.php?page_num=$page_num>
<select name=search>
<option name=search value=sname>이름으로</option>
<option name=search value=ssubject>제목으로</option>
<option name=search value=scontent>내용으로</option>
<option name=search value=stotal>전체에서</option>
</select>
<input type=text name=sfind>
<input type=submit name=submit value=찾기>
</form>
-->
</td>
<td colspan=1 align=right height=20 bgcolor=#8CBEF7>
<font size=2> <a href=boardwritei.php>글쓰기</a> </font>
</td>
</tr>
<tr>
<td colspan=5 align=center height=18 bgcolor=#f4f4f4>$boardcopyright</td>
</tr>
</table>
</body>
</html>
");
}
?>
에러 내용 : Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:apm_setupusersboardboardlist.php on line 11
<?
session_start();
include("./include/config.php");
include("./include/style.php");
$connect=mysql_connect("localhost","root","12345");
mysql_select_db("board",$connect);
$result = mysql_query("select * from $board order by re desc, tts", $connect);
$total=mysql_num_rows($result);
$page_max=15;
$page_total=ceil($total/$page_max);
$count_total=($page_num-1)*$page_max;
$uncounter=$total-(($page_num-1)*$page_max);
if(!$total) {
echo("
<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=euc-kr>
<title>Untitled Document</title>
$style
</head>
<table width=640 bordercolor=white border=0 cellspacing=2 cellpadding=0 align=center>
<tr>
<td colspan=5 align=right height=20 bgcolor=#8CBEF7><font size=2>
<a href=boardwritei.php> 글쓰기 </a></font>
</td>
</tr>
</table>
</body>
</html>
");
}else{
echo("
<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=euc-kr>
<title>Untitled Document</title>
$style
</head>
<body bgcolor=#f4f4f4>
<table width=640 border=0 cellspacing=0 cellpadding=0 align=left>
<tr>
<td colspan=4 width=50 nowrap bgcolor=#f4f4f4 height=18 align=left>
<font size=2 color=#00008C>$total</font>
</td>
<td colspan=1 width=50 nowrap bgcolor=#f4f4f4 height=18 align=center>
<font size=2 color=#00008C>$page_num / $page_total</font>
</td>
</tr>
<tr>
<td width=640 nowrap colspan=5 bgcolor=#8CBEF7 height=20 align=center>
<font size=4 color=white><b>Blue Free Board_1.0</b></font>
</td>
</tr>
<tr>
<td width=50 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> NUM</font>
</td>
<td width=440 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> TITLE</font>
</td>
<td width=50 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> NAME</font>
</td>
<td width=50 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> DATE</font>
</td>
<td width=50 nowrap bgcolor=#C8E0FF height=18 align=center>
<font size=2 color=#00008C> HIT</font>
</td>
</tr>
");
$day=mktime();
$today=date('m/d',$day);
$new="<font color=#FF5F55><sup>NEW</sup></font>";
$nbsp=" ";
for($i=0; $i<$page_max&$count_total<$total;) {
$num=mysql_result($result, $count_total ,"num");
$re=mysql_result($result, $count_total ,"re");
$subject=mysql_result($result, $count_total ,"subject");
$subject=stripslashes($subject);
$subject =substr("$subject",0,64);
$email=mysql_result($result,$count_total ,"email");
$name=mysql_result($result, $count_total ,"name");
$name =substr("$name",0,8);
$date=mysql_result($result, $count_total ,"date");
$click=mysql_result($result, $count_total ,"click");
$tts=mysql_result($result, $count_total, "tts");
$str=strlen($tts);
$tmp=time();
echo("
<tr bgcolor=#F0F8FF onMouseOver=this.style.backgroundColor='#DEF5FA' onMouseOut=this.style.backgroundColor=''>
<td nowrap height=18 align=center>
<font size=2 color=#444444>
");
if($UserID == $sessioncode) {
if($UserLOGINID=="admin"){
echo("<a href=boarddelete.php?num=$num&page_num=$page_num&re=$re&tts=$tts>$uncounter</a>");
}else{
echo("$uncounter");
}
}
echo("
</font>
</td>
<td nowrap height=18 align=left>
<font size=2 color=#444444>
<a href=boardread.php?num=$num&page_num=$page_num&click=$click>
");
for($j=1;$j<$str;$j++){
echo("$nbsp");
}
$k=1;
if($k<$str){
echo("↘");
}
echo("
${subject}
");
if($today==$date){
echo("$new");
}
echo("
</a></font>
</td>
<td nowrap height=18 align=center>
<font size=2 color=#444444>
$name</font>
</td>
<td nowrap height=18 align=center>
<font size=2 color=#444444>$date</font>
</td>
<td nowrap height=18 align=center>
<font size=2 color=#444444>$click</font>
</td>
</tr>
<tr>
<td colspan=5 bgcolor=#C8E0FF height=1></td>
</tr>
");
$i++;
$count_total++;
$uncounter=$uncounter-1;
}
echo("
<tr>
<td colspan=5 align=center height=18 bgcolor=#C8E0FF><font size=2>
");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////블럭지정 페이지 출력구문/////////////////////////////////////////////////////////////////////
$page_block=5; //페이지번호출력개수
$total_page=ceil($page_total/$page_block); //총페이지수/페이지번호출력개수3개
$block=ceil($page_num/$page_block); //현재페이지/페이지번호출력개수
$first=($block-1)*$page_block; //시작페이지번호
$end=$block*$page_block; //마지막페이지번호
if($block >=$total_page){
$end=$page_total;
}
if($block >1){
$page=$first-($page_block-1);
echo("
<b><a href=boardlist.php?page_num=$page> [이전 5]</a></b>
");
}else{
echo("[이전 5]");
}
for($p_num=$first+1; $p_num <= $end; $p_num++){
if($p_num==$page_num){
echo("<b>[$p_num]</b>");
}else{
echo("<a href=boardlist.php?page_num=$p_num>[$p_num]</a>");
}
}
if($block < $total_page){
$page=$end+1;
echo("
<b><a href=boardlist.php?page_num=$page> [다음 5]</a></b>
");
}else{
echo("[다음 5]");
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo("
</font>
</td>
</tr>
<tr>
<td colspan=4 align=left height=20 bgcolor=#8CBEF7>
<!--
<form method=post action=boardsearch.php?page_num=$page_num>
<select name=search>
<option name=search value=sname>이름으로</option>
<option name=search value=ssubject>제목으로</option>
<option name=search value=scontent>내용으로</option>
<option name=search value=stotal>전체에서</option>
</select>
<input type=text name=sfind>
<input type=submit name=submit value=찾기>
</form>
-->
</td>
<td colspan=1 align=right height=20 bgcolor=#8CBEF7>
<font size=2> <a href=boardwritei.php>글쓰기</a> </font>
</td>
</tr>
<tr>
<td colspan=5 align=center height=18 bgcolor=#f4f4f4>$boardcopyright</td>
</tr>
</table>
</body>
</html>
");
}
?>