parent
65d91f0e6f
commit
b57340c9ef
@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
@ -0,0 +1 @@
|
||||
nerve say nerve
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="1.8 (2)" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1 @@
|
||||
/build
|
||||
@ -0,0 +1,42 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.example.nervesaynerve"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
||||
implementation 'com.android.support:cardview-v7:28.0.0'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>连接数据库</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
$conn=mysqli_connect("localhost","root","3256137");
|
||||
if(!$conn){
|
||||
die("无法连接到mysql数据库:".mysqli_error($conn));}
|
||||
mysqli_select_db($conn,'xs');
|
||||
mysqli_set_charset($conn,"utf8");
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>destroy_session</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
session_destroy();
|
||||
echo "<script>url=\"login.html\";window.location.href=url;</script>";
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>login.php</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
include("connect.php");
|
||||
$username=$_POST['username'];
|
||||
$password=$_POST['password'];
|
||||
$sql="select userid from user where username='$username'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result)<=0)
|
||||
{
|
||||
echo "<script>alert(\"该用户不存在\");</script>";
|
||||
echo "<script>url=\"login.html\";window.location.href=url;</script>";}
|
||||
$sql="select userid from user where username='$username' and password='$password'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result)>0){
|
||||
echo "<script>url=\"index.php\";window.location.href=url;</script>";}
|
||||
else{
|
||||
echo "<script>alert(\"用户名或密码错误\");</script>";
|
||||
echo "<script>url=\"login.html\";window.location.href=url;</script>";}
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
<?php
|
||||
session_start();
|
||||
include("connect.php");
|
||||
$username=$_POST['username'];
|
||||
$password=$_POST['password'];
|
||||
$sql="select userid from user where username='$username' and password='$password'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result)>0){
|
||||
$_SESSION['username']=$username;
|
||||
echo "<script>url=\"index.php\",window.location.href=url;</script>";}
|
||||
else{
|
||||
echo "<script>alert(\"用户名或密码错误\");</script>";
|
||||
echo "<script>url=\"login.html\";window.location.href=url;</script>";}
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>register.php</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
$username=$_POST['username'];
|
||||
$password=$_POST['password'];
|
||||
$repassword=$_POST['repassword'];
|
||||
if($password!=$repassword){
|
||||
echo "<script>alert(\"两次密码不一致\");</script>";
|
||||
echo "<script>url=\"register.html\";window.location.href=url;</script>";
|
||||
exit();}
|
||||
include("connect.php");
|
||||
$sql="select userid from user where username='$username'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result)>0){
|
||||
echo "<script>alert(\"该用户已被注册\");</script>";
|
||||
echo "<script>url=\"register.html\";window.location.href=url;</script>";
|
||||
exit();}
|
||||
$sql="insert into user values(null,'$username','$password')";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if($result){
|
||||
echo "<script>alert(\"注册成功,登录\");</script>";
|
||||
echo "<script>url=\"login.html\";window.location.href=url;</script>";}
|
||||
else{
|
||||
die("Error: ".mysqli_error($conn));}
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,141 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>score.php</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
<?php
|
||||
include("connect.php");
|
||||
$name=$_POST['XM'];
|
||||
$kcm=$_POST['KCM'];
|
||||
$score=$_POST['CJ'];
|
||||
if(isset($_POST['录入']))
|
||||
{
|
||||
if(!strlen($name))
|
||||
{
|
||||
echo "<script>alert(\"姓名处不能为空\");</script>";
|
||||
exit();}
|
||||
$sql="select XM,KCM from cj where XM='$name' and KCM='$kcm'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result))
|
||||
{
|
||||
echo "<script>alert(\"该学生此课程成绩已录入\");</script>";
|
||||
exit();}
|
||||
$sql="insert into cj(XM,KCM,CJ) values('$name','$kcm','$score')";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if($result)
|
||||
{
|
||||
echo "<script>alert(\"录入成功\");</script>";
|
||||
$result=mysqli_query($conn,"select *from cj where XM='$name' and KCM='$kcm';");
|
||||
$row=mysqli_fetch_array($result);
|
||||
echo "<table border <tr><th>姓名</th><th>课程名</th><th>成绩</th></tr>";
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=80px>".$row['KCM']."</th>";
|
||||
echo "<th width=60px>".$row['CJ']."</th></tr>";
|
||||
echo "</table>";}
|
||||
else{
|
||||
echo "<script>alert(\"录入失败\");</script>";
|
||||
exit();}
|
||||
}
|
||||
if(isset($_POST['更新']))
|
||||
{
|
||||
if(!strlen($name)||!strlen($kcm)||!strlen($score))
|
||||
{
|
||||
echo "<script>alert(\"请填写完整信息\");</script>";
|
||||
exit();}
|
||||
$sql="select XM from cj where XM='$name'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(!mysqli_num_rows($result)){
|
||||
echo "<script>alert(\"该学生不存在\");</script>";
|
||||
exit();}
|
||||
$sql="update cj set CJ='$score' where XM='$name' and KCM='$kcm'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if($result)
|
||||
{
|
||||
echo "<script>alert(\"更新成功\");</script>";
|
||||
$result=mysqli_query($conn,"select *from cj where XM='$name' and KCM='$kcm'");
|
||||
$row=mysqli_fetch_array($result);
|
||||
echo "<table border <tr><th>姓名</th><th>课程名</th><th>成绩</th></tr>";
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=80px>".$row['KCM']."</th>";
|
||||
echo "<th width=40px>".$row['CJ']."</th></tr>";
|
||||
echo "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"更新失败\");</script>";
|
||||
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 "<table border <tr><th>姓名</th><th>课程名</th><th>成绩</th></tr>";
|
||||
while($row=mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=80px>".$row['KCM']."</th>";
|
||||
echo "<th width=60px>".$row['CJ']."</th></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"该学生不存在\");</script>";
|
||||
exit();}
|
||||
}
|
||||
else if(strlen($kcm))
|
||||
{
|
||||
$sql="select *from cj where KCM='$kcm'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result))
|
||||
{
|
||||
echo "<table border <tr><th>姓名</th><th>课程名</th><th>成绩</th></tr>";
|
||||
while($row=mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=80px>".$row['KCM']."</th>";
|
||||
echo "<th width=60px>".$row['CJ']."</th></tr>";}
|
||||
echo "</table>";}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"该课程无学生选择\");</script>";
|
||||
exit();}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['删除']))
|
||||
{
|
||||
if(!strlen($name)&&!strlen($kcm))
|
||||
{
|
||||
echo "<script>alert(\"姓名不能为空或课程名不能为空\");</script>";
|
||||
exit();}
|
||||
$sql="select XM from cj where XM='$name' and KCM='$kcm'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(!$result)
|
||||
{
|
||||
echo "<script>alert(\"该学生不存在\");</script>";
|
||||
exit();}
|
||||
$sql="delete from cj where XM='$name' and KCM='$kcm'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if($result)
|
||||
{
|
||||
echo "<script>alert(\"删除成功\");</script>";
|
||||
exit();}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"删除失败\");</script>";
|
||||
exit();}
|
||||
}
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,200 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>student.php</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
<?php
|
||||
include("connect.php");
|
||||
$name=$_POST['XM'];
|
||||
$xb=$_POST['XB'];
|
||||
$birthday=$_POST['CSSJ'];
|
||||
$kcs=$_POST['KCS'];
|
||||
if(isset($_POST['录入']))
|
||||
{
|
||||
if(!strlen($name))
|
||||
{
|
||||
echo "<script>alert(\"姓名不能为空\");</script>";
|
||||
exit();}
|
||||
$sql="select XM from student where XM='$name'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result))
|
||||
{
|
||||
echo "<script>alert(\"该学生已存在\");</script>";
|
||||
exit();}
|
||||
$sql="insert into student(XM,XB,CSSJ,KCS) values('$name','$xb','$birthday','$kcs')";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if($result)
|
||||
{
|
||||
echo "<script>alert(\"录入成功\");</script>";
|
||||
$result=mysqli_query($conn,"select *from student where XM='$name';");
|
||||
$row=mysqli_fetch_array($result);
|
||||
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=40px>";
|
||||
if($row['XB']==1) echo "男";
|
||||
else echo "女";
|
||||
echo "</th>";
|
||||
echo "<th width=120px>".$row['CSSJ']."</th>";
|
||||
echo "<th width=60px>".$row['KCS']."</th></tr>";
|
||||
echo "</table>";}
|
||||
else{
|
||||
echo "<script>alert(\"录入失败\");</script>";
|
||||
exit();}
|
||||
}
|
||||
if(isset($_POST['查询']))
|
||||
{
|
||||
if(!strlen($name)&&!strlen($xb)&&!strlen($kcs)){
|
||||
$sql="select *from student";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result))
|
||||
{
|
||||
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=40px>";
|
||||
if($row['XB']==1) echo "男";
|
||||
else echo "女";
|
||||
echo "</th>";
|
||||
echo "<th width=120px>".$row['CSSJ']."</th>";
|
||||
echo "<th width=60px>".$row['KCS']."</th></tr>";}}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"无学生\");</script>";
|
||||
exit();}
|
||||
}
|
||||
if(strlen($name))
|
||||
{
|
||||
$sql="select *from student where XM='$name'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result))
|
||||
{
|
||||
$result=mysqli_query($conn,"select *from student where XM='$name'");
|
||||
$row=mysqli_fetch_array($result);
|
||||
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=40px>";
|
||||
if($row['XB']==1) echo "男";
|
||||
else echo "女";
|
||||
echo "</th>";
|
||||
echo "<th width=120px>".$row['CSSJ']."</th>";
|
||||
echo "<th width=60px>".$row['KCS']."</th></tr>";
|
||||
echo "</table>";}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"该学生不存在\");</script>";
|
||||
exit();}
|
||||
}
|
||||
else if(strlen($xb))
|
||||
{
|
||||
$sql="select *from student where XB='$xb'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result))
|
||||
{
|
||||
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=40px>";
|
||||
if($row['XB']==1) echo "男";
|
||||
else echo "女";
|
||||
echo "</th>";
|
||||
echo "<th width=120px>".$row['CSSJ']."</th>";
|
||||
echo "<th width=60px>".$row['KCS']."</th></tr>";
|
||||
}
|
||||
echo "</table>";}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"查询无数据\");</script>";
|
||||
exit();}
|
||||
}
|
||||
else if(strlen($kcs))
|
||||
{
|
||||
$sql="select *from student where KCS='$kcs'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(mysqli_num_rows($result))
|
||||
{
|
||||
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=40px>";
|
||||
if($row['XB']==1) echo "男";
|
||||
else echo "女";
|
||||
echo "</th>";
|
||||
echo "<th width=120px>".$row['CSSJ']."</th>";
|
||||
echo "<th width=60px>".$row['KCS']."</th></tr>";}
|
||||
echo "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"查询无数据\");</script>";
|
||||
exit();}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['删除']))
|
||||
{
|
||||
if(!strlen($name))
|
||||
{
|
||||
echo "<script>alert(\"姓名不能为空\");</script>";
|
||||
exit();}
|
||||
$sql="select XM from student where XM='$name'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(!mysqli_num_rows($result))
|
||||
{
|
||||
echo "<script>alert(\"该学生不存在\");</script>";
|
||||
exit();}
|
||||
$sql="delete from student where XM='$name'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if($result)
|
||||
{
|
||||
echo "<script>alert(\"删除成功\");</script>";
|
||||
exit();}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"删除失败\");</script>";
|
||||
exit();}
|
||||
}
|
||||
if(isset($_POST['更新']))
|
||||
{
|
||||
if(!strlen($name)||!strlen($xb)||!strlen($birthday)||!strlen($kcs))
|
||||
{
|
||||
echo "<script>alert(\"请把信息填写完整\");</script>";
|
||||
exit();}
|
||||
$sql="select XM from student where XM='$name'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if(!mysqli_num_rows($result))
|
||||
{
|
||||
echo "<script>alert(\"该学生不存在\");</script>";
|
||||
exit();}
|
||||
$sql="update student set XB='$xb',CSSJ='$birthday',KCS='$kcs' where XM='$name'";
|
||||
$result=mysqli_query($conn,$sql);
|
||||
if($result)
|
||||
{
|
||||
echo "<script>alert(\"更新成功\");</script>";
|
||||
$result=mysqli_query($conn,"select *from student where XM='$name'");
|
||||
$row=mysqli_fetch_array($result);
|
||||
echo "<table border <tr><th>姓名</th><th>性别</th><th>出生日期</th><th>已修课程数</th></tr>";
|
||||
echo "<tr><th>".$row['XM']."</th>";
|
||||
echo "<th width=40px>";
|
||||
if($row['XB']==1) echo "男";
|
||||
else echo "女";
|
||||
echo "</th>";
|
||||
echo "<th width=120px>".$row['CSSJ']."</th>";
|
||||
echo "<th width=60px>".$row['KCS']."</th></tr>";
|
||||
echo "</table>";}
|
||||
else
|
||||
{
|
||||
echo "<script>alert(\"更新失败\");</script>";
|
||||
exit();}
|
||||
}
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in new issue