function getAllStudentsByLecture($lecObj, $n) { $conn = getConnection(); $stulist = array(); $batchID = $lecObj->getBatchID(); $query = "SELECT * FROM student WHERE batchID='" . $batchID . "' AND activeflag=1 ORDER BY firstname ASC,lastname ASC, rollno ASC"; $result = mysql_query($query); while ($member = mysql_fetch_array($result)) { $temp = getStudent($member['ID'], $n); array_push($stulist, $temp); } if (count($stulist) != 0) { return $stulist; } return NULL; }
function getAllMarksOfTestArranged1($testObj, $order) { $conn = getConnection(); $list = array(); $query = "SELECT * FROM marks WHERE testID = '" . $testObj->getID() . "' AND activeflag!=-3 ORDER BY mark DESC"; $result = mysql_query($query); while ($member = mysql_fetch_array($result)) { $tempstu = getStudent($member['studentID'], 1); $tempmark = getMarks($member['ID']); $temparray = array($tempstu, $tempmark); //$temp = array($stuobj[$i]); array_push($list, $temparray); } if (count($list) != 0) { return $list; } return NULL; }
<fieldset> <legend>Student Report</legend> <center> <form action='#' method='post'> From-Date: <input type='text' id='inputField1' name='datein' required=true/>  To-Date: <input type='text' id='inputField2' name='dateout' required=true></input><br><br><input type='submit' name='phase1'> </form> <div id='phase1'> <?php if(isset($_POST['phase1'])) { $arr = getObject($oid); //print_r($arr); $sidarr = getStudent($arr["obhandle"]); $rno =$sidarr["srno"]; $datein = $_POST["datein"]; $dateout = $_POST['dateout']; $Arr = queryMe("SELECT sid from MSTUDENTT where srno like '".strtoupper($rno)."'"); $sid = $Arr['sid']; $brid = getBranchFromSrno($rno); $obrid = getBranchFilter(); $result=mysql_query("select * from MSTUDENTT where srno='$rno'"); $rownum=mysql_num_rows($result); if($rownum<=0) { notifyerr("Invalid Hallticket Number"); }
<?php /** * Created by IntelliJ IDEA. * User: Tom * Date: 26.11.2015 * Time: 18:04 */ $_db_host = "localhost"; $_db_username = "******"; $_db_passwort = ""; $_db_datenbank = "eportfolio"; include 'functions.php'; if (isset($_GET['id_b'])) { $_student = getStudent($_GET['id_b'], $_db_host, $_db_username, $_db_passwort, $_db_datenbank); $_courses = getCourses($_GET['id_b'], $_db_host, $_db_username, $_db_passwort, $_db_datenbank); $_daten = mysqli_fetch_array($_student, MYSQLI_ASSOC); } ?> <html> <head> <title>Student <?php echo $_daten['MatNr']; ?> </title> </head> <body> <div id="info"> <h1>Data of Student <?php echo $_daten['MatNr'];
<?php include "dbquery.php"; if (isset($_POST['id'])) { $arr = getStudent($_POST['id']); if ($arr) { $json = json_encode($arr); echo $json; } else { echo json_encode(false); } }
function updateStudent($ID, $rollno, $grno, $firstname, $lastname, $Fname, $Mname, $address, $phone_stu, $phone_father, $phone_mother, $phone_other, $BatchObj, $picture, $activeflag, $userid, $comment, $actid, $ClassObj, $loginflag, $gender, $dateofbirth, $hscno, $cetno, $college, $email, $dateofadmission, $board10, $agg10, $ms10, $comment) { $conn = getConnection(); $picurl = uploadPicture($picture); $Obj = getStudent($ID, 0); $flag1 = false; $flag2 = false; if ($Obj->getPhoneFather() != $phone_father) { $flag1 = true; } if ($Obj->getPhoneStu() != $phone_stu) { $flag2 = true; } if ($activeflag == 0) { removeStudentFromMainTable($Obj->getMainID()); $Obj->setActiveFlag(trim($activeflag)); $result = $Obj->update(); $message = "Student Deletion Succeeded : " . $Obj->getName(); return $message; } if ($flag1) { updateMainFatherNumber($Obj->getMainID(), $phone_father); } if ($flag2) { updateMainStudentNumber($Obj->getMainID(), $phone_stu); } if ($picurl == '') { $picurl = $Obj->getPicUrl(); } $Obj->setRollNo(trim($rollno)); $Obj->setGRno(trim($grno)); $Obj->setFirstName(trim($firstname)); $Obj->setLastName(trim($lastname)); $Obj->setMname(trim($Mname)); $Obj->setFname(trim($Fname)); $Obj->setPicUrl(trim($picurl)); $Obj->setAddress(trim($address)); $Obj->setPhoneStu(trim($phone_stu)); $Obj->setPhoneFather(trim($phone_father)); $Obj->setPhoneMother(trim($phone_mother)); $Obj->setPhoneOther(trim($phone_other)); //$Obj->setBatchObj($BatchObj); $Obj->setPicUrl($picurl); $Obj->setActiveFlag(trim($activeflag)); $Obj->setLastEditedBy(trim($userid)); $Obj->setComments(trim($comments)); $Obj->setActid(trim($actid)); //$Obj->setClassObj($ClassObj); $Obj->setLoginFlag(trim($loginflag)); $Obj->setGender(trim($gender)); $Obj->setDateOfBirth(trim($dateofbirth)); $Obj->setHscNo(trim($hscno)); $Obj->setCetNo(trim($cetno)); $Obj->setCollege(trim($college)); $Obj->setEmail(trim($email)); $Obj->setDateOfAdmission(trim($dateofadmission)); $Obj->setBoard10(trim($board10)); $Obj->setAggregate10(trim($agg10)); $Obj->setMathsScience10(trim($ms10)); $Obj->setComments(trim($comment)); $result = $Obj->update(); if ($result) { $message = "Student Updated Successfully :" . $Obj->getName(); } else { $message = "Student Updation Failed : " . $Obj->getName(); } return $message; }
try { $students = StudentFetcher::retrieveAll(); $majors = MajorFetcher::retrieveMajors(); $appointments = AppointmentFetcher::retrievePendingForAllStudents(); if (isBtnAddStudentPrsd()) { $majorId = !empty($_POST['userMajorId']) ? $_POST['userMajorId'] : null; Student::create($_POST['firstName'], $_POST['lastName'], $_POST['email'], $_POST['studentId'], $_POST['mobileNum'], $majorId, $_POST['ciInput'], $_POST['creditsInput']); header('Location: ' . BASE_URL . "academia/students/success"); exit; } else { if (isBtnAddMajorPrsd()) { Major::create($_POST['majorCode'], $_POST['majorName']); header('Location: ' . BASE_URL . "academia/students/success"); } else { if (isBtnUpdatePrsd()) { if (!isset($_POST['idUpdate']) || ($oldStudentData = getStudent($_POST['idUpdate'], $students)) === false) { throw new Exception("Data tempering detected. Process stopped."); } else { $id = $oldStudentData[StudentFetcher::DB_COLUMN_ID]; $newFirstName = $_POST['newFirstName']; $newLastName = $_POST['newLastName']; $newEmail = $_POST['newEmail']; $newStudentId = $_POST['newStudentId']; $newMobileNum = $_POST['newMobileNum']; $newMajorId = $_POST['newStudentMajorId']; $newCI = isset($_POST['newCI']) ? $_POST['newCI'] : null; $newCreditsNum = $_POST['newCreditsNum']; Student::updateFirstName($id, $newFirstName, $oldStudentData[StudentFetcher::DB_COLUMN_FIRST_NAME]); Student::updateLastName($id, $newLastName, $oldStudentData[StudentFetcher::DB_COLUMN_LAST_NAME]); Student::updateStudentId($id, $newStudentId, $oldStudentData[StudentFetcher::DB_COLUMN_STUDENT_ID]); Student::updateEmail($id, $newEmail, $oldStudentData[StudentFetcher::DB_COLUMN_EMAIL]);
<?php include 'db_helper.php'; if ($_GET['f'] == 'add' && $_GET['name'] && $_GET['gender'] && $_GET['email'] && $_GET['phone']) { addStudent($_GET['name'], $_GET['gender'], $_GET['email'], $_GET['phone']); } elseif ($_GET['f'] == 'get' && $_GET['email']) { getStudent($_GET['email']); } elseif ($_GET['f'] == 'update' && $_GET['name'] && $_GET['gender'] && $_GET['phone'] && $_GET['sid']) { updateStudent($_GET['name'], $_GET['gender'], $_GET['phone'], $_GET['sid']); } elseif ($_GET['f'] == 'get' && $_GET['sid']) { getStudentInfo($_GET['sid']); } function getStudent($email) { $dbQuery = sprintf("SELECT ID FROM Student WHERE email = '%s'", mysql_real_escape_string($email)); // $result = getDBResultRecord($dbQuery); //header("Content-type: application/json"); echo json_encode($result); } function addStudent($name, $gender, $email, $phone) { $dbQuery = sprintf("INSERT INTO Student (name,gender,email,phone) VALUES ('%s','%d','%s','%d')", mysql_real_escape_string($name), $gender, mysql_real_escape_string($email), $phone); $result = getDBResultInserted($dbQuery, 'ID'); //header("Content-type: application/json"); echo json_encode($result); } function updateStudent($name, $gender, $phone, $sid) { $dbQuery = sprintf("UPDATE Student SET name = '%s',gender='%d',phone='%d' WHERE ID = '%d'", mysql_real_escape_string($name), $gender, $phone, $sid); $result = getDBResultAffected($dbQuery);
foreach ($students as $student) { if (in_array($id, $student)) { return "<p>ID: " . $student['id'] . "</p><p>Name: " . $student['name'] . " " . $student['surname'] . "</p><p>Address: " . $student['address'] . "</p><p>Number: " . $student['number'] . "</p><p> Mark: " . $student['mark'] . "</p>"; } } return "Student with ID: {$id} not found."; } function resetMarks() { global $students; foreach ($students as &$student) { $student['mark'] = 0; } } getStudents(); $student = getStudent("STUD_123"); dump($student); resetMarks(); dump($students); ?> <p> Create an array containing 20 numbers. Using loops, display the maximum, minimum, average and sum of the numbers.</p> <p> Create an associative array having ID Card as key and Name as value. Then iterate through the array and display values.</p> <?php $numbers = array(); function minNum($array) { $count = count($array); if ($count == 0) {
break; case 3: echo json_encode(getAllGroups()); break; case 4: echo json_encode(getTasksFromClass($_POST['group'])); break; case 5: echo json_encode(getStudentsFromClass($_POST['group'])); break; case 6: echo json_encode(getAllGroupsReport()); break; case 7: echo json_encode(getTeacherUserGroupsReport($_POST['id'])); break; case 8: echo json_encode(getAllStudents()); break; case 9: if (isset($_POST['student'])) { echo json_encode(getStudent($_POST['student'])); } else { echo "No proper data"; } break; default: } } else { echo "No proper data"; }
function getStudentObj() { return getStudent($this->studentID, 1); }