Basic functions: 1, to achieve the maintenance of basic information of students (increase and deletion), 2, to achieve the maintenance of course information (increase and deletion), 3, to achieve the management of elective courses (elective courses, withdrawal); 4. Achieve Results Management (entry), statistical students and average grade of the course
- $conn =mysql_connect ("localhost", "root", "123456") or Die (' Connection failed ');//Connection server
- mysql_select_db ("Yggl", $conn) or Die (' connection database failed ');//Select Database
- mysql_query ("Set NAMES ' gb2312 '");//Set character sets
- $Number =@$_get[' number ']; Get number
- $Name =@$_get[' Name ']; Get Name
- $Depart =@$_get[' depart ']; Get Department Name
- GetSQL function for generating query statements
- function GetSQL ($Num, $Na, $DEP)
- {
- $sql = "SELECT * from Employees where";
- $note = 0;
- if ($Num)
- {
- Set the query condition after the WHERE clause if the number is filled in
- $sql. = "EmployeeID like '% $Num% '";
- $note = 1;
- }
- if ($Na)
- {
- If you fill in your name, connect the query criteria after $sql
- if ($note ==1)
- $sql. = "and Name like '% $Na% '";
- Else
- $sql. = "Name like '% $Na% '";
- $note = 1;
- }
- if ($Dep && ($Dep! = "All Departments"))
- {
- if ($note ==1)
- $sql. = "and departmentid= (select DepartmentID from departments
- where departmentname= ' $Dep ') ";
- Else
- {
- $sql. = "departmentid= (select DepartmentID from departments
- where departmentname= ' $Dep ') ";
- $note = 1;
- }
- }
- if ($note ==0)
- {
- Query all records If none of the conditions are set
- $sql = "SELECT * from Employees";
- }
- return $sql;//Returns SQL statement
- }
- $sql =getsql ($Number, $Name, $Depart);//Get query statement
- $result =mysql_query ($sql);
- $total =mysql_num_rows ($result);
- $page =isset ($_get[' page ')? $_get[' page ']:1; Gets the value of the page in the Address bar, set to 1 if it does not exist
- $num = 5; Show 5 records per page
- $url = ' 8_1.php '; Page URL
- Page Count
- $pagenum =ceil ($total/$num);//Get total pages and last page
- $page =min ($pagenum, $page);//Get home
- $PREPG = $page -1;//Previous page
- $NEXTPG = ($page = = $pagenum? 0: $page + 1); Next page
- $new _sql= $sql. "Limit". ($page-1) * $num. ",". $num;//Find query statements for $num Records
- $new _result=mysql_query ($new _sql);
- if ($new _row=mysql_fetch_array ($new _result))
- {
- Output employee information in tabular format if query results are available
- echo "
- Employee Information Query Results
";
- echo "
- echo "
- echo "
- echo "
- echo "
- echo "
- echo "
- Do
- echo "
- echo "
- if ($sex = = ' 1 ')
- Else
- $timeTemp =strtotime ($birthday); Resolves a datetime to a UNIX timestamp
- echo "
- echo "
- }while ($new _row=mysql_fetch_array ($new _result));
- {
- List ($number, $name, $edu, $birthday, $sex, $workyear, $phone, $add, $depid) = $new _row;
- SQL statement to find the department name
- $d _sql= "Select Departmentname from departments where departmentid= $depid"; $d _result=mysql_query ($d _sql);
- $d _row=mysql_fetch_row ($d _result);
- echo "
- echo "
- echo "
- $date =date ("Y-n-j", $timeTemp); Convert time to "year-month-day" form with the date function
- echo "
- echo "
";
Number | ";
Name | ";
Degree | ";
Gender | ";
Date of birth | ";
Department in which |
";
$number | ";//Output number
$name | ";//Output name
$edu | ";//Output education
Man | ";
Woman | ";
$date | ";//output Date of birth
$d _row[0] | ";//The name of the department where the output is
";
";
- Start Page navigation bar code
- $pagenav = "";
- if ($PREPG)
- $pagenav. = "
- Previous Page ";
- for ($i =1; $i <= $pagenum; $i + +)
- {
- if ($page = = $i) $pagenav. = $i. " ";
- Else
- $pagenav. = "
- $i ";
- }
- if ($NEXTPG)
- $pagenav. = "
- Next Page ";
- $pagenav. = "Total (". $pagenum. ") Page ";
- Output Paging navigation
- echo "
" . $pagenav.";
- }
- Else
- echo "";
- ?>
Copy Code
- Employee Information Enquiry
- Employee Information Enquiry
- @include "sy8_1_search.php";//contains sy8_1_search.php page
- ?>
Copy Code
- Employee Income Page
- Employee Income Status
- @include "sy8_2_pro.php";//contains sy8_2_pro.php page
- ?>
Copy Code
- $Number =$_post[' number '];
- $conn =mysql_connect (' localhost ', ' root ', ') or Die ("Connection failed");
- mysql_select_db ("Yggl", $conn);//Open database
- $s _sql= "select * from Salary where employeeid= ' $Number '";
- $s _result=mysql_query ($s _sql, $conn);
- $s _row=mysql_fetch_array ($s _result);
- $id =@ $s _row[' EmployeeID ';
- $in =@ $s _row[' InCome ';
- $out =@ $s _row[' outcome ';
- @ $realcom = $in-$out;
- ?>
- if (isset ($_post[' Update '))
- {
- $EmployeeID =$_post[' number '];
- $income =$_post[' income '];
- $outcome =$_post[' outcome '];
- if (Is_numeric ($income) &&is_numeric ($outcome))//Determine if the input is a numeric string
- {
- if ($EmployeeID)
- {
- Modifying SQL statements for table salary
- $u _sql= "Update salary set Income= $income, Outcome= $outcome
- where employeeid= ' $EmployeeID ';
- $u _result=mysql_query ($u _sql);
- if (mysql_rows_affected ($conn)!=0)
- echo "";
- }
- Else
- echo "";
- }
- Else
- echo "";
- }
- ?>
Copy Code |