Home Backend Development PHP Tutorial Student performance management system

Student performance management system

Jul 25, 2016 am 09:09 AM

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. ?>
    复制代码


    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

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

    JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

    How does session hijacking work and how can you mitigate it in PHP? How does session hijacking work and how can you mitigate it in PHP? Apr 06, 2025 am 12:02 AM

    Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

    How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

    How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

    Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

    The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

    How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

    How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

    How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

    Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

    Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

    Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

    See all articles