alert(\"姓名处不能为空\");"; exit();} $sql="select XM,KCM from cj where XM='$name' and KCM='$kcm'"; $result=mysqli_query($conn,$sql); if(mysqli_num_rows($result)) { echo ""; exit();} $sql="insert into cj(XM,KCM,CJ) values('$name','$kcm','$score')"; $result=mysqli_query($conn,$sql); if($result) { echo ""; $result=mysqli_query($conn,"select *from cj where XM='$name' and KCM='$kcm';"); $row=mysqli_fetch_array($result); echo ""; echo ""; echo ""; echo ""; echo "
姓名课程名成绩
".$row['XM']."".$row['KCM']."".$row['CJ']."
";} else{ echo ""; exit();} } if(isset($_POST['更新'])) { if(!strlen($name)||!strlen($kcm)||!strlen($score)) { echo ""; exit();} $sql="select XM from cj where XM='$name'"; $result=mysqli_query($conn,$sql); if(!mysqli_num_rows($result)){ echo ""; exit();} $sql="update cj set CJ='$score' where XM='$name' and KCM='$kcm'"; $result=mysqli_query($conn,$sql); if($result) { echo ""; $result=mysqli_query($conn,"select *from cj where XM='$name' and KCM='$kcm'"); $row=mysqli_fetch_array($result); echo ""; echo ""; echo ""; echo ""; echo "
姓名课程名成绩
".$row['XM']."".$row['KCM']."".$row['CJ']."
"; } else { echo ""; exit();} } if(isset($_POST['查询'])) { if(strlen($name)) { $sql="select *from cj where XM='$name'"; $result=mysqli_query($conn,$sql); if(mysqli_num_rows($result)) { echo ""; while($row=mysqli_fetch_array($result)) { echo ""; echo ""; echo ""; } echo "
姓名课程名成绩
".$row['XM']."".$row['KCM']."".$row['CJ']."
"; } else { echo ""; exit();} } else if(strlen($kcm)) { $sql="select *from cj where KCM='$kcm'"; $result=mysqli_query($conn,$sql); if(mysqli_num_rows($result)) { echo ""; while($row=mysqli_fetch_array($result)) { echo ""; echo ""; echo "";} echo "
姓名课程名成绩
".$row['XM']."".$row['KCM']."".$row['CJ']."
";} else { echo ""; exit();} } } if(isset($_POST['删除'])) { if(!strlen($name)&&!strlen($kcm)) { echo ""; exit();} $sql="select XM from cj where XM='$name' and KCM='$kcm'"; $result=mysqli_query($conn,$sql); if(!$result) { echo ""; exit();} $sql="delete from cj where XM='$name' and KCM='$kcm'"; $result=mysqli_query($conn,$sql); if($result) { echo ""; exit();} else { echo ""; exit();} } mysqli_close($conn); ?>