From 454d3062c31f421f4fd6252b334888d3c9f25add Mon Sep 17 00:00:00 2001 From: fish <280768265@qq.com> Date: Wed, 20 May 2020 17:50:16 +0800 Subject: [PATCH] Update Script.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 邀请前检查该student_id是否已存在 --- Script.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Script.php b/Script.php index 7abf942..a44accd 100644 --- a/Script.php +++ b/Script.php @@ -1101,8 +1101,13 @@ if($result>20) - $sql="INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`) - VALUES ($groupid,$student_id,'Invited')"; + $result = mysqli_query($con,"SELECT * FROM course_group_members_table where Course_Group_id = '$groupid' and Student_ID = '$student_id'"); + if(mysqli_num_rows($result)>0){ + header("Location: Course.php?url=".$url); + }else{ + $sql="INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`) + VALUES ($groupid,$student_id,'Invited')"; + } if ($con->query($sql) === TRUE) { $_SESSION["info_ReMarking"]=$student_id . " was invited to the group"; header("Location: Course.php?url=".$url);