Home > Backend Development > PHP Tutorial > Student performance management system

Student performance management system

WBOY
Release: 2016-07-25 09:09:53
Original
1585 people have browsed it
Basic functions: 1. Realize the maintenance of students’ basic information (add, delete and modify); 2. Realize the maintenance of course information (add, delete and modify); 3. Realize the management of course selection (course selection, withdrawal); 4. Realize the performance management (entry), Statistics on student and course average grades
  1. $conn=mysql_connect("localhost","root","123456") or die('Connection failed'); //Connect to the server
  2. mysql_select_db("YGGL",$conn) or die('Failed to connect to database'); //Select database
  3. mysql_query("SET NAMES 'gb2312'"); //Set character set
  4. $Number=@$_GET['Number']; //Get number
  5. $Name =@$_GET['Name']; //Get the name
  6. $Depart=@$_GET['Depart']; //Get the department name
  7. //The getsql function that generates the query statement
  8. function getsql($Num,$Na ,$Dep)
  9. {
  10. $sql="select * from Employees where ";
  11. $note=0;
  12. if($Num)
  13. {
  14. //If the number is filled in, set the query conditions after the where clause
  15. $ sql.="EmployeeID like '%$Num%'";
  16. $note=1;
  17. }
  18. if($Na)
  19. {
  20. //If the name is filled in, connect the query conditions after $sql
  21. if($note ==1)
  22. $sql.=" and Name like '%$Na%'";
  23. else
  24. $sql.="Name like '%$Na%'";
  25. $note=1;
  26. }
  27. if( $Dep&&($Dep!="All Departments"))
  28. {
  29. if($note==1)
  30. $sql.=" and DepartmentID=(select DepartmentID from Departments
  31. where DepartmentName='$Dep')";
  32. else
  33. {
  34. $sql.="DepartmentID=(select DepartmentID from Departments
  35. where DepartmentName='$Dep')";
  36. $note=1;
  37. }
  38. }
  39. if($note==0)
  40. {
  41. / /If no conditions are set, query all records
  42. $sql="select * from Employees";
  43. }
  44. return $sql; //Return SQL statement
  45. }
  46. $sql=getsql($Number,$Name,$Depart ); //Get the query statement
  47. $result=mysql_query($sql);
  48. $total=mysql_num_rows($result);
  49. $page=isset($_GET['page'])?$_GET['page']: 1; //Get the value of page in the address bar, if it does not exist, set it to 1
  50. $num=5; //Display 5 records per page
  51. $url='8_1.php'; //URL of this page
  52. // Page number calculation
  53. $pagenum=ceil($total/$num); //Get the total page number, which is also the last page
  54. $page=min($pagenum,$page); //Get the home page
  55. $prepg=$page- 1; //Previous page
  56. $nextpg=($page==$pagenum? 0: $page+1); //Next page
  57. $new_sql=$sql." limit ".($page-1)* $num.",".$num; //Query statement to find $num records
  58. $new_result=mysql_query($new_sql);
  59. if($new_row=mysql_fetch_array($new_result))
  60. {
  61. //If there is a query As a result, employee information will be output in table form
  62. echo "
  63. Employee information query results echo "";
  64. echo "
  65. ";
  66. echo "
  67. ";
  68. echo "
  69. ";
  70. echo "
  71. ";
  72. echo "
  73. ";
  74. do
  75. {
  76. list($number,$name,$edu ,$birthday,$sex,$workyear,$phone,$add,$depid)=$new_row;
  77. //SQL statement to find department name
  78. $d_sql="select DepartmentName from Departments where DepartmentID=$depid"; $d_result =mysql_query($d_sql);
  79. $d_row=mysql_fetch_row($d_result);
  80. echo "
  81. "; //Output number
  82. echo "
  83. "; //Output academic qualifications
  84. if($sex=='1')
  85. echo "
  86. ";
  87. $timeTemp=strtotime($birthday); //Parse the date and time into a UNIX timestamp
  88. $date=date("Y-n-j" ,$timeTemp); //Use the date function to convert the time into "year-month-day" format
  89. echo "
  90. "; //Output the date of birth
  91. echo "
  92. "; //Output the name of the department
  93. echo "
  94. ";
  95. }while($new_row=mysql_fetch_array($new_result));
  96. echo "
  97. number
  98. echo "
  99. Name Education Gender Date of Birth Department
    $number $name< /td>"; //Output name
  100. echo "
  101. $edu Male";
  102. else
  103. echo "
  104. Female $date $ d_row[0]
    ";
  105. //Start paging navigation bar code
  106. $pagenav="";
  107. if($prepg)
  108. $pagenav.="< ;a href='$url?page=$prepg&Number=$Number&Name=$Name&Depart=$Depart'>
  109. Previous page ";
  110. for($i=1;$i<=$pagenum; $i++)
  111. {
  112. if($page==$i) $pagenav.=$i." ";
  113. else
  114. $pagenav.="
  115. $i ";
  116. }
  117. if($nextpg)
  118. $pagenav.="
  119. Next page";
  120. $pagenav.="Total (".$pagenum.") pages";
  121. //Output paging navigation
  122. echo "
    < div align=center class=STYLE1>".$pagenav."
";
  • }
  • else
  • echo "<script>alert('No record!'); location.href='8_1.php';</script>";
  • ?>
  • Copy code
    1. Employee information query
    2. 员工收入情况
    3. 编号:
    4. @include "SY8_2_pro.php"; //包含SY8_2_pro.php页面
    5. ?>
    复制代码
    1. $Number=$_POST['Number'];
    2. $conn=mysql_connect('localhost', 'root', '') or die("连接失败");
    3. mysql_select_db("YGGL",$conn); //打开数据库
    4. $s_sql="select * from Salary where EmployeeID='$Number'";
    5. $s_result=mysql_query($s_sql,$conn);
    6. $s_row=mysql_fetch_array($s_result);
    7. $id=@$s_row['EmployeeID'];
    8. $in=@$s_row['InCome'];
    9. $out=@$s_row['OutCome'];
    10. @$realcom=$in-$out;
    11. ?>
    12. 编号:
      收入:
      支出:
      实际收入:
    13. if(isset($_POST['update']))
    14. {
    15. $EmployeeID=$_POST['number'];
    16. $income=$_POST['income'];
    17. $outcome=$_POST['outcome'];
    18. if(is_numeric($income)&&is_numeric($outcome)) //判断输入的是否是数字字符串
    19. {
    20. if($EmployeeID)
    21. {
    22. //修改表salary的SQL语句
    23. $u_sql="update salary set InCome=$income,OutCome=$outcome
    24. where EmployeeID='$EmployeeID'";
    25. $u_result=mysql_query($u_sql);
    26. if(mysql_rows_affected($conn)!=0)
    27. echo "<script>alert('修改成功!');window.location='SY8_2.php';</script>";
    28. }
    29. else
    30. echo "<script>alert('未获得编号!');window.location='SY8_2.php';</script>";
    31. }
    32. else
    33. echo "<script>alert('输入不正确!');window.location='SY8_2.php';</script>";
    34. }
    35. ?>
    复制代码


    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template