本文整理汇总了PHP中Student::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::update方法的具体用法?PHP Student::update怎么用?PHP Student::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Student
function test_update()
{
$name = "Chris";
$date = "1111-11-11";
$test_student = new Student($name, $date);
$test_student->save();
$new_name = "Chris the Jerk";
$test_student->update($new_name);
$this->assertEquals("Chris the Jerk", $test_student->getName());
}
示例2: testUpdate
function testUpdate()
{
$name = "Bob";
$enrollment_date = "2015-01-01";
$test_student = new Student($name, $enrollment_date);
$test_student->save();
$new_name = "Kevin";
$test_student->update($new_name, $enrollment_date);
$this->assertEquals("Kevin", $test_student->getName());
}
示例3: testUpdate
function testUpdate()
{
//Arrange
$name = "Ben";
$enroll_date = "0000-00-00";
$id = 1;
$test_student = new Student($name, $enroll_date, $id);
$test_student->save();
$new_name = "Jen";
//Act
$test_student->update($new_name);
//Assert
$this->assertEquals($new_name, $test_student->getName());
}
示例4: testUpdate
function testUpdate()
{
//Arrange
$name = "Elliot Michaels";
$date = "2015-08-03";
$id = 1;
$test_student = new Student($name, $date, $id);
$test_student->save();
$new_name = "Drake Michaels";
//Act
$test_student->update($new_name);
//Assert
$this->assertEquals("Drake Michaels", $test_student->getName());
}
示例5: Student
function test_update()
{
//Arange
$name = "Steve Beekman";
$date = "2015-08-23";
$test_student = new Student($name, $date);
$test_student->save();
$name2 = "Fred Flintstone";
$date2 = "0001-01-01";
$test_student->update($name2, $date2);
//Act
$id = $test_student->getId();
$result = new Student($name2, $date2, $id);
//Assert
$this->assertEquals(Student::find($id), $result);
}
示例6: htmlspecialchars
$decriptionError = 'You must enter a description for the student';
} else {
//what they typed was okay, so store it to show it in the form
$description = $_POST['udescription'];
}
//END VALIDATION
//ADD THE ROW: if all the values the user typed are valid...
if ($all_valid == true) {
$student->stud_name = $_POST['ustud_name'];
$student->prog_id = $_POST['uprog_id'];
$student->quarter = $_POST['uquarter'];
$student->award = $_POST['uaward'];
$student->description = $_POST['udescription'];
$student->image = $_FILES['uimage'];
//Perform the following query based on the information provided by the user
if ($student->update($stud_id)) {
echo '<p class="success">Student record has been updated.</p>';
} else {
//otherwise show 'fail' feedback
echo '<p class="danger">ERROR: Student record has NOT been updated.</p>';
}
}
//END THE ADD ROW
}
//END THE POST. Now in all cases show them the form...
?>
<form action="<?php
echo htmlspecialchars($_SERVER["PHP_SELF"]);
?>
" method="post" enctype="multipart/form-data" id="add-form">
示例7: Student
require_once "init.php";
//echo "i am here";
$student = new Student(new PDOdb("mysql:host=localhost;dbname=usjr", "root", ""));
$result = $student->show();
if (!$result) {
echo "No data contained in the result set...";
} else {
foreach ($result as $res) {
echo $res['studid'] . ' ' . $res['studfname'] . ' ' . $res['studlname'] . "<br>";
}
}
// $studid = 'AA-002';
// $studfname = 'Jeoffrey';
// $studlname = 'Gudio';
// $studmname = 'Camocamo';
// $studcourse = 'BSIT';
// $studyear = 4;
// $result = $student->insert(array($studid,$studfname,
// $studlname,$studmname,$studcourse,$studyear));
// if($result > 0)
// echo "Data added";
// else
// echo "Data was not added";
$result = $student->update(array('studid' => 'AA01', 'studfname' => 'Jeoffrey'), array('studlname' => 'Gudio', 'studcourse' => 'BSCS'), 2);
echo $result;
if ($result > 0) {
echo "Operation done";
} else {
echo "Operation failed";
}
示例8: Student
<?php
require_once "../init.php";
$student = new Student(new PDOdb("mysql:host=localhost;dbname=usjr", "root", ""));
$studid = $_POST['stid'];
$studfname = $_POST['stfname'];
$studmname = $_POST['stmname'];
$studlname = $_POST['stlname'];
$studcourse = $_POST['stcourse'];
$studyear = $_POST['styear'];
$result = $student->update(array('studfname' => $studfname, 'studmname' => $studmname, 'studlname' => $studlname, 'studcourse' => $studcourse, 'studyear' => $studyear), array('studid' => $studid), 1);
header('Location:studentUpdateList.php');
示例9: Student
function test_update()
{
//Arrange
$name = "Shmuel Irving-Jones";
$enroll_date = "2015-08-25";
$test_student = new Student($name, $enroll_date);
$test_student->save();
$new_name = "Reginald Irving-Jones";
//Act
$test_student->update($new_name);
//Assert
$this->assertEquals($new_name, $test_student->getName());
}
示例10: showStudent
function showStudent()
{
global $connector;
global $result;
$student = new Student();
$course = new Course();
$plan = new Plan();
$student->setConnector($connector);
$course->setConnector($connector);
$plan->setConnector($connector);
if (isset($_POST['operation'])) {
list($operation, $params) = explode("#", $_POST['operation']);
switch ($operation) {
case 'delete':
$error_msg = $student->delete($params);
break;
case 'edit':
$stud = $student->getById($params);
$result['edit'] = $stud;
$result['edit']->student = $stud;
$exam = new Exam();
$exam->setConnector($connector);
$result['edit']->exam = $exam->getList($result['edit']->student);
break;
case 'editChanges':
$student->storeFormValues($_POST);
$error_msg = $student->update();
break;
case 'saveChanges':
$student->storeFormValues($_POST);
$error_msg = $student->insert();
if ($error_msg) {
$result['edit'] = $student;
}
break;
case 'nextPage':
$student->storeFormValues($_POST);
$result['edit'] = $student;
break;
case 'createPassword':
$stud = $student->getById($params);
$stud->setConnector($connector);
$error_msg = $stud->generatePassword();
$result['edit'] = $stud;
break;
default:
$error_msg = "Operazione non valida";
}
if ($error_msg != "") {
$result["errorMessage"] = $error_msg;
} elseif ($operation != 'edit' && $operation != "nextPage") {
$result["statusMessage"] = "Operazione completata!";
}
}
if (isset($_POST['search'])) {
$result["students"] = $student->search($_POST['search']);
} else {
$result["students"] = $student->getList();
}
$result["plans"] = $plan->getList("id_piano");
$result["courses"] = $course->getList("nome");
$page = "student.php";
include_once BASE_PATH . "template.php";
}
示例11: testUpdate
function testUpdate()
{
//Arrange
$student_name = "Paco";
$id = 1;
$enroll_date = "2015-08-29";
$test_student = new Student($student_name, $enroll_date, $id);
$test_student->save();
$new_student_name = "Pablo";
//Act
$test_student->update($new_student_name);
//Assert
$this->assertEquals("Pablo", $test_student->getStudentName());
}
示例12: Student
function test_update()
{
//Arrange
$name = "Jeff Lebowski";
$enrollment_date = "1973-12-12";
$id = 1;
$student = new Student($name, $enrollment_date, $id);
$student->save();
$new_name = "The Dude";
//Act
$student->update($new_name);
//Assert
$this->assertEquals("The Dude", $student->getName());
}
示例13: update
public static function update($id, $data)
{
session_start();
$headers = apache_request_headers();
$token = $headers['X-Auth-Token'];
if (!$headers['X-Auth-Token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, '1msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
die;
} else {
if ($token != $_SESSION['form_token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, 'msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['studid']) && empty($data['studid'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Student ID is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['fname']) && empty($data['fname'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Student Firstname is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['lname']) && empty($data['lname'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Student Lastname is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['mobileno']) && empty($data['mobileno'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Mobile No. is required'), JSON_PRETTY_PRINT);
die;
} else {
if (isset($data['email']) && empty($data['email'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Email Address is required'), JSON_PRETTY_PRINT);
die;
} else {
$var = ['studid' => $data['studid'], 'fname' => $data['fname'], 'lname' => $data['lname'], 'mobileno' => $data['mobileno'], 'email' => $data['email'], 'address' => $data['address'], 'birthdate' => $data['birthdate'], 'graduated' => $data['graduated'], 'last_school' => $data['last_school'], 'pref_course' => $data['pref_course'], 'gender' => $data['gender']];
Student::update($id, $var);
}
}
}
}
}
}
}
}
示例14: Student
function test_update()
{
//Arrange
$student_name = "Joker";
$enrollment_date = "6000-12-14";
$id = 1;
$student = new Student($student_name, $enrollment_date, $id);
$student->save();
$new_student_name = "Spot";
//Act
$student->update($new_student_name);
//Assert
$this->assertEquals("Spot", $student->getStudentName());
}
示例15: switch
$stage = "1";
if (isset($_REQUEST["stage"])) {
$stage = $_REQUEST["stage"];
}
switch ($stage) {
case "2":
case "final":
$student->setSurName($_POST["surname"]);
$student->setOtherNames($_POST["otherNames"]);
$student->setSchoolID($_POST["schoolID"]);
//$student -> setDateOfBirth( $_POST[ "dateOfBirth" ] );
$student->setDateOfAdmission($_POST["dateOfAdmission"]);
$student->setGender($_POST["gender"]);
$student->setYearOfStudyAtAdmission($_POST["yearOfStudyAtAdmission"]);
$student->setEntryScore($_POST["entryScore"]);
if ($student->update()) {
$pageBody .= '
<div class="dialog info">
<p>The following student : </p>
<table>
<tbody>
<tr>
<th>school ID</th>
<td>' . $student->getSchoolID() . '</td>
</tr>
<tr>
<th>name</th>
<td>' . $student->getSurName() . ', ' . $student->getOtherNames() . '</td>
</tr> <!--
<tr>
<th>Date of Birth</th>