Admin: admin@webdamn.com password:123
We will implement user login on login form submit by calling method adminLogin() from class School.php
include('class/School.php'); $school = new School(); $school->adminLogin(); In class School.php , we will implement method adminLogin() .
public function adminLogin()< $errorMessage = ''; if(!empty($_POST["login"]) && $_POST["email"]!=''&& $_POST["password"]!='') < $email = $_POST['email']; $password = $_POST['password']; $sqlQuery = "SELECT * FROM ".$this->userTable." WHERE email='".$email."' AND password='".md5($password)."' AND status = 'active' AND type = 'administrator'"; $resultSet = mysqli_query($this->dbConnect, $sqlQuery) or die("error".mysql_error()); $isValidLogin = mysqli_num_rows($resultSet); if($isValidLogin) < $userDetails = mysqli_fetch_assoc($resultSet); $_SESSION["adminUserid"] = $userDetails['id']; $_SESSION["admin"] = $userDetails['first_name']." ".$userDetails['last_name']; header("location: dashboard.php"); >else < $errorMessage = "Invalid login!"; >> else if(!empty($_POST["login"])) < $errorMessage = "Enter Both user and password!"; >return $errorMessage; > Step3: Manage Teachers Section In teacher.php file, we will create design to add new teacher details edit and display teacher list.
Teachers Section ID Name Assigned Subjects Class Sections
We will call School class methods addTeacher() , updateTeacher and listTeacher() to handle teachers functionality.
public function listTeacher() < $sqlQuery = "SELECT t.teacher_id, t.teacher, s.subject, c.name, se.section FROM ".$this-if(!empty($_POST["order"])) < $sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' '; >else < $sqlQuery .= 'ORDER BY t.teacher_id DESC '; >if($_POST[«length»] != -1) < $sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length']; >$result = mysqli_query($this-button type=»button» name=»update» teacher_id»].'» /buttonbutton type=»button» name=»delete» teacher_id»].'» /button $output = array( «draw» =
Step4: Manage Student Sections In students.php file, we will design to display student list, save new student admission, update and delete student details.
Student Section ID Reg No Roll No Name Photo Class Section
We will call School class methods addStudent() , updateStudent , deleteStudent and listStudent() to handle teachers functionality.
public function listStudent()< $sqlQuery = "SELECT s.id, s.name, s.photo, s.gender, s.dob, s.mobile, s.email, s.current_address, s.father_name, s.mother_name,s.admission_no, s.roll_no, s.admission_date, s.academic_year, c.name as class, se.section FROM ".$this->studentTable." as s LEFT JOIN ".$this->classesTable." as c ON s.class = c.id LEFT JOIN ".$this->sectionsTable." as se ON s.section = se.section_id "; if(!empty($_POST["search"]["value"])) < $sqlQuery .= ' WHERE (s.id LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR s.name LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR s.gender LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR s.mobile LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR s.admission_no LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR s.roll_no LIKE "%'.$_POST["search"]["value"].'%" '; >if(!empty($_POST["order"])) < $sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' '; >else < $sqlQuery .= 'ORDER BY s.id DESC '; >if($_POST["length"] != -1) < $sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length']; >$result = mysqli_query($this->dbConnect, $sqlQuery); $numRows = mysqli_num_rows($result); $studentData = array(); while( $student = mysqli_fetch_assoc($result) ) < $studentRows = array(); $studentRows[] = $student['id']; $studentRows[] = $student['admission_no']; $studentRows[] = $student['roll_no']; $studentRows[] = $student['name']; $studentRows[] = " "; $studentRows[] = $student['class']; $studentRows[] = $student['section']; $studentRows[] = 'Update '; $studentRows[] = 'Delete '; $studentData[] = $studentRows; > $output = array( "draw" => intval($_POST["draw"]), "recordsTotal" => $numRows, "recordsFiltered" => $numRows, "data" => $studentData ); echo json_encode($output); > Step5: Manage Classes Section In classes.php file, we will design HTML to handle classes functionality like create class, update class, delete class and list classes.
Classes Section ID Name Sections Class Teacher
We will call School class methods addClass() , updateClass , deleteClass and listClasses() to handle classes functionality.
public function listClasses()< $sqlQuery = "SELECT c.id, c.name, s.section, t.teacher FROM ".$this->classesTable." as c LEFT JOIN ".$this->sectionsTable." as s ON c.section = s.section_id LEFT JOIN ".$this->teacherTable." as t ON c.teacher_id = t.teacher_id "; if(!empty($_POST["search"]["value"])) < $sqlQuery .= ' WHERE (c.id LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR c.name LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR s.section LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR t.teacher LIKE "%'.$_POST["search"]["value"].'%" '; >if(!empty($_POST["order"])) < $sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' '; >else < $sqlQuery .= 'ORDER BY c.id DESC '; >if($_POST["length"] != -1) < $sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length']; >$result = mysqli_query($this->dbConnect, $sqlQuery); $numRows = mysqli_num_rows($result); $classesData = array(); while( $classes = mysqli_fetch_assoc($result) ) < $classesRows = array(); $classesRows[] = $classes['id']; $classesRows[] = $classes['name']; $classesRows[] = $classes['section']; $classesRows[] = $classes['teacher']; $classesRows[] = 'Update '; $classesRows[] = 'Delete '; $classesData[] = $classesRows; > $output = array( "draw" => intval($_POST["draw"]), "recordsTotal" => $numRows, "recordsFiltered" => $numRows, "data" => $classesData ); echo json_encode($output); > Step6: Manage Subjects Section In subjects.php file, we will design page to handle functionality to add new subjects, update, delete and list subjects.
Subjects Section ID Subject Code Subject Type
We will call School class methods addSubject() , updateSubject , deleteSubject and listSubject() to handle Subjects functionality.
public function listSubject()< $sqlQuery = "SELECT subject_id, subject, type, code FROM ".$this->subjectsTable." "; if(!empty($_POST["search"]["value"])) < $sqlQuery .= ' WHERE (subject_id LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR subject LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR type LIKE "%'.$_POST["search"]["value"].'%" '; $sqlQuery .= ' OR code LIKE "%'.$_POST["search"]["value"].'%" '; >if(!empty($_POST["order"])) < $sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' '; >else < $sqlQuery .= 'ORDER BY subject_id DESC '; >if($_POST["length"] != -1) < $sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length']; >$result = mysqli_query($this->dbConnect, $sqlQuery); $numRows = mysqli_num_rows($result); $subjectData = array(); while( $subject = mysqli_fetch_assoc($result) ) < $subjectRows = array(); $subjectRows[] = $subject['subject_id']; $subjectRows[] = $subject['subject']; $subjectRows[] = $subject['code']; $subjectRows[] = $subject['type']; $subjectRows[] = 'Update '; $subjectRows[] = 'Delete '; $subjectData[] = $subjectRows; > $output = array( "draw" => intval($_POST["draw"]), "recordsTotal" => $numRows, "recordsFiltered" => $numRows, "data" => $subjectData ); echo json_encode($output); > Step7: Manage Student Attendance Section In attendance.php file, we will design HTML to search class and section student attendance and list. We will also create student attendance form to handle students attendance functionality.
Student Attendance Section We will implement class section student serach functionality to perform student attendance.
$('#search').click(function() < $('#studentList').removeClass('hidden'); $('#saveAttendance').removeClass('hidden'); if ($.fn.DataTable.isDataTable("#studentList")) < $('#studentList').DataTable().clear().destroy(); >var classid = $('#classid').val(); var sectionid = $('#sectionid').val(); if(classid && sectionid) < $.ajax(< url:"action.php", method:"POST", data:, success:function(data) < $('#message').text(data).removeClass('hidden'); >>) $('#studentList').DataTable(< "lengthChange": false, "processing":true, "serverSide":true, "order":[], "ajax":< url:"action.php", type:"POST", data:, dataType:"json" >, "columnDefs":[ < "targets":[0], "orderable":false, >, ], "pageLength": 10 >); > >); We will also implement students attendance functionality bu handle form submit.
$("#attendanceForm").submit(function(e) < var formData = $(this).serialize(); $.ajax(< url:"action.php", method:"POST", data:formData, success:function(data)< $('#message').text(data).removeClass('hidden'); >>); return false; >); We will handle student attendance update functionality by calling method updateAttendance() from class School.php .
public function updateAttendance()< $attendanceYear = date('Y'); $attendanceMonth = date('m'); $attendanceDay = date('d'); $attendanceDate = $attendanceYear."/".$attendanceMonth."/".$attendanceDay; $sqlQuery = "SELECT * FROM ".$this->attendanceTable." WHERE class_id = '".$_POST["att_classid"]."' AND section_id = '".$_POST["att_sectionid"]."' AND attendance_date = '".$attendanceDate."'"; $result = mysqli_query($this->dbConnect, $sqlQuery); $attendanceDone = mysqli_num_rows($result); if($attendanceDone) < foreach($_POST as $key =>$value) < if (strpos($key, "attendencetype_") !== false) < $student_id = str_replace("attendencetype_","", $key); $attendanceStatus = $value; if($student_id) < $updateQuery = "UPDATE ".$this->attendanceTable." SET attendance_status = '".$attendanceStatus."' WHERE student_id = '".$student_id."' AND class_id = '".$_POST["att_classid"]."' AND section_id = '".$_POST["att_sectionid"]."' AND attendance_date = '".$attendanceDate."'"; mysqli_query($this->dbConnect, $updateQuery); > > > echo "Attendance updated successfully!"; > else < foreach($_POST as $key =>$value) < if (strpos($key, "attendencetype_") !== false) < $student_id = str_replace("attendencetype_","", $key); $attendanceStatus = $value; if($student_id) < $insertQuery = "INSERT INTO ".$this->attendanceTable."(student_id, class_id, section_id, attendance_status, attendance_date) VALUES ('".$student_id."', '".$_POST["att_classid"]."', '".$_POST["att_sectionid"]."', '".$attendanceStatus."', '".$attendanceDate."')"; mysqli_query($this->dbConnect, $insertQuery); > > > echo "Attendance save successfully!"; > > You may also like:
User Management System with PHP & MySQL Datatables Add Edit Delete with Ajax, PHP & MySQL Build Helpdesk System with jQuery, PHP & MySQL Build Online Voting System with PHP & MySQL DataTables Add Edit Delete with CodeIgniter Create RESTful API using CodeIgniter Build Reusable Captcha Script with PHP Product Search Filtering using Ajax, PHP & MySQL Image Upload and Crop in Modal with jQuery, PHP & MySQL Build Push Notification System with PHP & MySQL Project Management System with PHP and MySQL Hospital Management System with PHP & MySQL Build Newsletter System with PHP and MySQL Skeleton Screen Loading Effect with Ajax and PHP Build Discussion Forum with PHP and MySQL Customer Relationship Management (CRM) System with PHP & MySQL Online Exam System with PHP & MySQL Expense Management System with PHP & MySQL You can view the live demo from the Demo link and can download the script from the Download link below. Demo Download
Источник
pandas.plotting.boxplot# Make a box-and-whisker plot
table-layout¶ Свойство table-layout определяет, как
HTML Размеры таблицы HTML таблицы могут иметь разные
table-layout¶ Свойство table-layout определяет, как