require_once 'includes/db_con.php';
$response = mysql_query("SELECT * FROM gre WHERE `verbal-1` = 1");
$i = 1;
$unanswer = 0;
$right_answer=0;
$wrong_answer=0;
/*?>$unanswered=0;<?php */
while($result=mysql_fetch_array($response)){
$get_ans = $result['ans1'] + $result['ans2'] + $result['ans3'];
if(isset($_POST["single-1".$i])){
if($get_ans == $_POST["single-1".$i]){
$right_answer++;
}
}else if(isset($_POST["double-1".$i],$_POST["double-2".$i])){
if($get_ans == $_POST["double-1".$i]+$_POST["double-2".$i]){
$right_answer++;
}
}else if(isset($_POST["three-1".$i],$_POST["three-2".$i],$_POST["three-3".$i]){
if($get_ans == $_POST["three-1".$i]+$_POST["three-2".$i]+$_POST["three-3".$i]){
$right_answer++;
}
}else if(isset($_POST["multi-1".$i],$_POST["multi-1".$i]){
if($get_ans == $_POST["multi-1".$i]+$_POST["multi-1".$i]){
$right_answer++;
}
}else if(isset($_POST["body-1".$i]){
if($get_ans == $_POST["body-1".$i]){
$right_answer++;
}
}else{
$wrong_answer++;
}
$i++;
}
答案 0 :(得分:2)
你错过了一个&#34;)&#34;,如果(isset())应该是其他的。
答案 1 :(得分:1)
else if(isset($_POST["three-1".$i],$_POST["three-2".$i],$_POST["three-3".$i]){
if($get_ans == $_POST["three-1".$i]+$_POST["three-2".$i]+$_POST["three-3".$i]){
$right_answer++;
}
}else if(isset($_POST["multi-1".$i],$_POST["multi-1".$i]){
if($get_ans == $_POST["multi-1".$i]+$_POST["multi-1".$i]){
$right_answer++;
}
}else if(isset($_POST["body-1".$i]){
应该是
else if(isset($_POST["three-1".$i],$_POST["three-2".$i],$_POST["three-3".$i])){
^ - missing
if($get_ans == $_POST["three-1".$i]+$_POST["three-2".$i]+$_POST["three-3".$i]){
$right_answer++;
}
}else if(isset($_POST["multi-1".$i],$_POST["multi-1".$i])) {
^ - missing
if($get_ans == $_POST["multi-1".$i]+$_POST["multi-1".$i]){
$right_answer++;
}
}else if(isset($_POST["body-1".$i])) {
^ - missing