<?php$con=mysqli_connect("localhost:3306","root","bwcx130313");if(!mysqli_select_db($con,"student")){echo"连接失败".mysqli_connect_error();
exit;}elseecho"连接成功";mysqli_query($con,"set names utf8");$stuid=$_POST["stuid"];$stuname=$_POST["stuname"];$stusex=$_POST["stusex"];$stubirth=$_POST["stubirth"];$stuschool=$_POST["stuschool"];$sql="insert into stu values('$stuid','$stuname','$stusex','$stubirth','$stuschool')";if(mysqli_query($con,$sql))echo"添加成功";elseecho"添加失败";mysqli_close($con);?>
<?php$con=mysqli_connect("localhost:3306","root","bwcx130313");if(!mysqli_select_db($con,"student")){echo"连接失败".mysqli_connect_error();
exit;}elseecho"连接成功";mysqli_query($con,"set names utf8");$q="select stuid,stuname,stusex,stubirth,stuschool from stu where stuID=1805004425";$result=mysqli_query($con,$q);if($result){echo"信息查询成功<br>";$p=mysqli_fetch_array($result,MYSQLI_BOTH);if($p){echo"stuid:.".$p[0]."<br>";echo"stuname:".$p[1]."<br>";echo"stusex:.".$p[2]."<br>";echo"stubirth:".$p[3]."<br>";echo"stuschool:".$p[4]."<br>";}else{echo"信息不存在";}}else{echo"信息查询失败";}?>
<?php$con=mysqli_connect("localhost:3306","root","bwcx130313");if(!mysqli_select_db($con,"student")){echo"连接失败".mysqli_connect_error();
exit;}elseecho"连接成功";mysqli_query($con,"set names utf8");$stuid=$_POST["stuid"];$q="delete from stu where stuid='$stuid'";if(mysqli_query($con,$q)){echo"修改成功";}else{echo"修改失败";}?>