search
HomeBackend DevelopmentPHP TutorialStudent performance management system

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
  64. > ;";
  65. echo "";
  66. echo "
  67. > ;";
  68. echo "
  69. ";
  70. echo "
  71. ";
  72. echo "
  73. ";
  74. echo "
  75. ";
  76. echo "
  77. ";
  78. do
  79. {
  80. list($number,$name,$edu ,$birthday,$sex,$workyear,$phone,$add,$depid)=$new_row;
  81. //SQL statement to find department name
  82. $d_sql="select DepartmentName from Departments where DepartmentID=$depid"; $d_result =mysql_query($d_sql);
  83. $d_row=mysql_fetch_row($d_result);
  84. echo "
  85. "; //Output number
  86. echo "
  87. "; //Output academic qualifications
  88. if($sex=='1')
  89. echo "
  90. ";
  91. $timeTemp=strtotime($birthday); //Parse the date and time into a UNIX timestamp
  92. $date=date("Y-n-j" ,$timeTemp); //Use the date function to convert the time into "year-month-day" format
  93. echo "
  94. "; //Output the date of birth
  95. echo "
  96. "; //Output the name of the department
  97. echo "
  98. ";
  99. }while($new_row=mysql_fetch_array($new_result));
  100. echo "
  101. numberName Education Gender Date of Birth Department
    $number$name"; //Output name
  102. echo "
  103. $edu Male td>";
  104. else
  105. echo "
  106. Female $date $ d_row[0]
    ";
  107. //Start paging navigation bar code
  108. $pagenav="";
  109. if($prepg)
  110. $pagenav.="< ;a href='$url?page=$prepg&Number=$Number&Name=$Name&Depart=$Depart'>
  111. Previous page ";
  112. for($i=1;$i {
  113. if($page==$i) $pagenav.=$i." ";
  114. else
  115. $pagenav.="
  116. $i
  117. ";
  118. }
  119. if($nextpg)
  120. $pagenav.="
  121. Next page
  122. ";
  123. $pagenav.="Total (".$pagenum.") pages";
  124. //Output paging navigation
  125. echo "
    ".$pagenav."
";
  • }
  • else
  • echo "<script>alert('No record!'); location.href='8_1.php';</script>";
  • ?>
  • Copy code
    1. Employee information query
  • > ;
  • Number:< ;/td>
  • Department:
  • @include "SY8_1_search.php"; //Contains the SY8_1_search.php page
  • ?>
  • < ;/html>
  • Copy code
    1. 员工收入页面
    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
    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
    Explain the concept of session locking.Explain the concept of session locking.Apr 29, 2025 am 12:39 AM

    Sessionlockingisatechniqueusedtoensureauser'ssessionremainsexclusivetooneuseratatime.Itiscrucialforpreventingdatacorruptionandsecuritybreachesinmulti-userapplications.Sessionlockingisimplementedusingserver-sidelockingmechanisms,suchasReentrantLockinJ

    Are there any alternatives to PHP sessions?Are there any alternatives to PHP sessions?Apr 29, 2025 am 12:36 AM

    Alternatives to PHP sessions include Cookies, Token-based Authentication, Database-based Sessions, and Redis/Memcached. 1.Cookies manage sessions by storing data on the client, which is simple but low in security. 2.Token-based Authentication uses tokens to verify users, which is highly secure but requires additional logic. 3.Database-basedSessions stores data in the database, which has good scalability but may affect performance. 4. Redis/Memcached uses distributed cache to improve performance and scalability, but requires additional matching

    What is the full form of PHP?What is the full form of PHP?Apr 28, 2025 pm 04:58 PM

    The article discusses PHP, detailing its full form, main uses in web development, comparison with Python and Java, and its ease of learning for beginners.

    How does PHP handle form data?How does PHP handle form data?Apr 28, 2025 pm 04:57 PM

    PHP handles form data using $\_POST and $\_GET superglobals, with security ensured through validation, sanitization, and secure database interactions.

    What is the difference between PHP and ASP.NET?What is the difference between PHP and ASP.NET?Apr 28, 2025 pm 04:56 PM

    The article compares PHP and ASP.NET, focusing on their suitability for large-scale web applications, performance differences, and security features. Both are viable for large projects, but PHP is open-source and platform-independent, while ASP.NET,

    Is PHP a case-sensitive language?Is PHP a case-sensitive language?Apr 28, 2025 pm 04:55 PM

    PHP's case sensitivity varies: functions are insensitive, while variables and classes are sensitive. Best practices include consistent naming and using case-insensitive functions for comparisons.

    How do you redirect a page in PHP?How do you redirect a page in PHP?Apr 28, 2025 pm 04:54 PM

    The article discusses various methods for page redirection in PHP, focusing on the header() function and addressing common issues like "headers already sent" errors.

    Explain type hinting in PHPExplain type hinting in PHPApr 28, 2025 pm 04:52 PM

    Article discusses type hinting in PHP, a feature for specifying expected data types in functions. Main issue is improving code quality and readability through type enforcement.

    See all articles

    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

    MantisBT

    MantisBT

    Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

    EditPlus Chinese cracked version

    EditPlus Chinese cracked version

    Small size, syntax highlighting, does not support code prompt function

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    ZendStudio 13.5.1 Mac

    ZendStudio 13.5.1 Mac

    Powerful PHP integrated development environment

    SecLists

    SecLists

    SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.