묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
설문조사 php인데요 틀린곳좀 잡아주세요 ㅠ.ㅜ
2004.07.31 20:25
<!-- poll.html -->
<html>
<head>
<title> php예제 </title>
<script>
function checknsubmit(){
var data = document.mainform;
if(!data.ans.value){
alert('하나를 선택해 주십시오.');
return;
}
data.submit();
}
</script>
</head>
<body bgcolor=white>
<center>
<form method=post action=poll_post.php name=mainform>
<input type=hidden name=number value='<?echo $number;?>'>
<table border=1 cellspacing=0 cellpadding=5 bordercolor=#ffccff>
<tr>
<td>
<table border=0 cellspacing=2 cellpadding=0>
<?
$conn = mysql_connect('localhost','root','apmsetup');
mysql_select_db('sadm', $conn);
$query = "select issue,ans1,ans2,ans3,ans4,ans5,ans6,ans7,ans8,edate from poll";
$query.= " where number = $number";
$result = mysql_query($query , $conn);
$data = mysql_fetch_array($result); <!--33번 에러 자리-->
if(!$data[edate]){
echo("
<tr>
<td colspan=2 align=center bgcolor=#dddddd>
<b> $data[issue] </b>
</td>
</tr>
");
if($data[ans0]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans0] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=0></td>
</tr>
");
}
if($data[ans1]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans1] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=1></td>
</tr>
");
}
if($data[ans2]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans2] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=2></td>
</tr>
");
}
if($data[ans3]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans3] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=3></td>
</tr>
");
}
if($data[ans4]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans4] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=4></td>
</tr>
");
}
if($data[ans5]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans5] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=5></td>
</tr>
");
}
if($data[ans6]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans6] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=6></td>
</tr>
");
}
if($data[ans7]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans7] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=7></td>
</tr>
");
}
}
else{
echo("
<tr>
<td colspan=2 align=center>
<b> $data[issue] </b>
<br>
이 설문은 $data[edate] 에 종료하였습니다 <br>
</td>
</tr>
");
}
?>
<tr>
<td colspan=2 align=center>
<input type=button value='확인' onclick=javascript:checknsubmit{}>
[<a href=poll_view.html?number=<?echo $number;?>> 결과보기 </a>]
</td>
</table>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
--------------------------------------------------------------------------------
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:apm_setuphtdocssadmpoll.html on line 33
이렇게 뜨거든요? mysql_fetch_array(); 만 쓰면 이런에러가 자주 나요 ㅡ.ㅜ 알려주세요~
<html>
<head>
<title> php예제 </title>
<script>
function checknsubmit(){
var data = document.mainform;
if(!data.ans.value){
alert('하나를 선택해 주십시오.');
return;
}
data.submit();
}
</script>
</head>
<body bgcolor=white>
<center>
<form method=post action=poll_post.php name=mainform>
<input type=hidden name=number value='<?echo $number;?>'>
<table border=1 cellspacing=0 cellpadding=5 bordercolor=#ffccff>
<tr>
<td>
<table border=0 cellspacing=2 cellpadding=0>
<?
$conn = mysql_connect('localhost','root','apmsetup');
mysql_select_db('sadm', $conn);
$query = "select issue,ans1,ans2,ans3,ans4,ans5,ans6,ans7,ans8,edate from poll";
$query.= " where number = $number";
$result = mysql_query($query , $conn);
$data = mysql_fetch_array($result); <!--33번 에러 자리-->
if(!$data[edate]){
echo("
<tr>
<td colspan=2 align=center bgcolor=#dddddd>
<b> $data[issue] </b>
</td>
</tr>
");
if($data[ans0]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans0] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=0></td>
</tr>
");
}
if($data[ans1]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans1] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=1></td>
</tr>
");
}
if($data[ans2]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans2] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=2></td>
</tr>
");
}
if($data[ans3]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans3] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=3></td>
</tr>
");
}
if($data[ans4]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans4] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=4></td>
</tr>
");
}
if($data[ans5]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans5] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=5></td>
</tr>
");
}
if($data[ans6]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans6] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=6></td>
</tr>
");
}
if($data[ans7]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans7] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=7></td>
</tr>
");
}
}
else{
echo("
<tr>
<td colspan=2 align=center>
<b> $data[issue] </b>
<br>
이 설문은 $data[edate] 에 종료하였습니다 <br>
</td>
</tr>
");
}
?>
<tr>
<td colspan=2 align=center>
<input type=button value='확인' onclick=javascript:checknsubmit{}>
[<a href=poll_view.html?number=<?echo $number;?>> 결과보기 </a>]
</td>
</table>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
--------------------------------------------------------------------------------
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:apm_setuphtdocssadmpoll.html on line 33
이렇게 뜨거든요? mysql_fetch_array(); 만 쓰면 이런에러가 자주 나요 ㅡ.ㅜ 알려주세요~