Student achievement management system

Source: Internet
Author: User
Student achievement management system
Basic functions: 1. maintain basic information of students (add, delete, modify, and delete); 2. maintain course information (add, delete, modify, and delete course information ); 3. course selection management (course selection and course withdrawal); 4. score management (entry), Statistics, and average course score

  1. $ Conn = mysql_connect ("localhost", "root", "123456") or die ('connection failed'); // connect to the server
  2. Mysql_select_db ("YGGL", $ conn) or die ('database connection failed'); // select a database
  3. Mysql_query ("set names 'gb2312 '"); // sets the character SET.
  4. $ Number = @ $ _ GET ['Number']; // GET the Number
  5. $ Name = @ $ _ GET ['name']; // GET the Name
  6. $ Depart = @ $ _ GET ['demo']; // Obtain the department name.
  7. // Generate the getsql function of 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 entered, set the query condition after the where clause
  15. $ SQL. = "EmployeeID like '% $ Num % '";
  16. $ Note = 1;
  17. }
  18. If ($ Na)
  19. {
  20. // If the name is entered, the query conditions are connected 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 between mentid = (select between mentid from orders ments
  31. Where DepartmentName = '$ dep ')";
  32. Else
  33. {
  34. $ SQL. = "explain mentid = (select distinct mentid from orders ments
  35. Where DepartmentName = '$ dep ')";
  36. $ Note = 1;
  37. }
  38. }
  39. If ($ note = 0)
  40. {
  41. // If no conditions are set, all records are queried.
  42. $ SQL = "select * from Employees ";
  43. }
  44. Return $ SQL; // return an SQL statement
  45. }
  46. $ SQL = getsql ($ Number, $ Name, $ Depart); // Obtain the query statement.
  47. $ Result = mysql_query ($ SQL );
  48. $ Total = mysql_num_rows ($ result );
  49. $ Page = isset ($ _ GET ['Page'])? $ _ GET ['Page']: 1; // GET the page value in the address bar. if the page does not exist, set it to 1.
  50. $ Num = 5; // 5 records are displayed on each page
  51. $ Url = '8 _ 1. php'; // URL of the current page
  52. // Page number calculation
  53. $ Pagenum = ceil ($ total/$ num); // obtain the total number of pages, which is also the last page.
  54. $ Page = min ($ pagenum, $ page); // Get the homepage
  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 statements for $ 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 result, the employee information is output in the form of a table
  62. Echo"
  63. Employee Information query result
  64. ";
  65. Echo"
  66. Echo"
  67. Echo"
  68. Echo"
  69. Echo"
  70. Echo"
  71. Echo"
  72. Do
  73. Echo"
  74. Echo"
  75. If ($ sex = '1 ')
  76. Else
  77. $ TimeTemp = strtotime ($ birthday); // Parse the date and time as a UNIX timestamp
  78. Echo"
  79. Echo"
  80. } While ($ new_row = mysql_fetch_array ($ new_result ));
  81. {
  82. List ($ number, $ name, $ edu, $ birthday, $ sex, $ workyear, $ phone, $ add, $ depid) = $ new_row;
  83. // Query the SQL statement of the department name
  84. $ D_ SQL = "select DepartmentName from orders ments where orders mentid = $ depid"; $ d_result = mysql_query ($ d_ SQL );
  85. $ D_row = mysql_fetch_row ($ d_result );
  86. Echo"
  87. Echo"
  88. Echo"
  89. $ Date = date ("Y-n-j", $ timeTemp); // use the date function to convert the time to the "year-month-day" format.
  90. Echo"
  91. Echo"
  92. "; "; "; "; "; "; "; "; // Output number "; // Output name "; // Output degree "; "; "; // Output the date of birth "; // Output the name of the department ";
    No.NameEducation levelGenderDate of birthDepartment
    $ Number$ Name$ EduMaleFemale$ Date$ D_row [0]
    ";
  93. // Start the paging navigation bar code
  94. $ Pagenav = "";
  95. If ($ prepg)
  96. $ Pagenav. ="
  97. Previous page ";
  98. For ($ I = 1; $ I <= $ pagenum; $ I ++)
  99. {
  100. If ($ page = $ I) $ pagenav. = $ I ."";
  101. Else
  102. $ Pagenav. ="
  103. $ I ";
  104. }
  105. If ($ nextpg)
  106. $ Pagenav. ="
  107. Next page ";
  108. $ Pagenav. = "total (". $ pagenum. ") page ";
  109. // Output paging navigation
  110. Echo"

    ". $ Pagenav ."

    ";
  111. }
  112. Else
  113. Echo "script" alert ('No record! '); Location. href = '8 _ 1. php'; script ";
  114. ?>

  1. Employee Information Query
  2. Employee Information Query

  3. @ Include "sy8_mongosearch.php"; // contains the sy8_mongosearch.php page.
  4. ?>

  1. Employee income page
  2. Employee income

  3. @ Include "SY8_2_pro.php"; // contains the SY8_2_pro.php page.
  4. ?>

  1. $ Number = $ _ POST ['Number'];
  2. $ Conn = mysql_connect ('localhost', 'root', '') or die (" connection failed ");
  3. Mysql_select_db ("YGGL", $ conn); // open the database
  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 ['Welcome '];
  9. $ Out = @ $ s_row ['outcome '];
  10. @ $ Realcom = $ in-$ out;
  11. ?>
  12. If (isset ($ _ POST ['update'])
  13. {
  14. $ EmployeeID = $ _ POST ['Number'];
  15. $ Income = $ _ POST ['Welcome '];
  16. $ Outcome = $ _ POST ['outcome '];
  17. If (is_numeric ($ income) & is_numeric ($ outcome) // determines whether the input is a numeric string
  18. {
  19. If ($ EmployeeID)
  20. {
  21. // Modify the SQL statement of table salary
  22. $ U_ SQL = "update salary set InCome = $ income, OutCome = $ outcome
  23. Where EmployeeID = '$ EmployeeID '";
  24. $ U_result = mysql_query ($ u_ SQL );
  25. If (mysql_rows_affected ($ conn )! = 0)
  26. Echo "script" alert ('modification successful! '); Window. location = 'sy8 _ 2. php'; script ";
  27. }
  28. Else
  29. Echo "script" alert ('no number is obtained! '); Window. location = 'sy8 _ 2. php'; script ";
  30. }
  31. Else
  32. Echo "script" alert ('The input is incorrect! '); Window. location = 'sy8 _ 2. php'; script ";
  33. }
  34. ?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.