本文整理汇总了PHP中Student::set_first_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::set_first_name方法的具体用法?PHP Student::set_first_name怎么用?PHP Student::set_first_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::set_first_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _map_posted_data
private function _map_posted_data()
{
$student = new Student();
$student->set_first_name($_POST['first_name']);
$student->set_last_name($_POST['last_name']);
$student->set_dob($_POST['dob']);
$student->set_blood_group($_POST['blood_group']);
$student->set_email($_POST['email']);
$student->set_contact($_POST['contact']);
$student->set_program_id($_POST['program_id']);
return $student;
}
示例2: get_all
public function get_all()
{
$student_list = array();
$this->db->connect();
$sql = "SELECT * from tbl_student";
$result = $this->db->fetchQuery($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$student = new Student();
$student->set_id($row['id']);
$student->set_first_name($row['first_name']);
$student->set_last_name($row['last_name']);
$student->set_dob($row['dob']);
$student->set_blood_group($row['blood_group']);
$student->set_email($row['email']);
$student->set_contact($row['contact']);
$student->set_program_id($row['program_id']);
array_push($student_list, $student);
}
}
$this->db->close();
return $student_list;
}
示例3: get_by_id
public function get_by_id($id)
{
$student = null;
$this->db->connect();
$sql = "SELECT id,first_name,last_name,dob,blood_group,email,contact,program_id from tbl_student WHERE id=?";
$stmt = $this->db->initStatement($sql);
$stmt->bind_param("i", $id);
$stmt->execute();
$stmt->bind_result($id, $first_name, $last_name, $dob, $blood_group, $email, $contact, $program_id);
while ($stmt->fetch()) {
$student = new Student();
$student->set_id($id);
$student->set_first_name($first_name);
$student->set_last_name($last_name);
$student->set_dob($dob);
$student->set_blood_group($blood_group);
$student->set_email($email);
$student->set_contact($contact);
$student->set_program_id($program_id);
}
$this->db->close();
return $student;
}
示例4: header
<?php
include_once '../config.php';
include_once ROOT_PATH . 'system/models/student.class.php';
include_once ROOT_PATH . 'system/repository/student_repository.class.php';
include_once 'header.php';
if (!isset($_POST['submit'])) {
header('location:student.php?error=nopage');
}
$student = new Student();
$student->set_first_name($_POST['first_name']);
$student->set_last_name($_POST['last_name']);
$student->set_dob($_POST['dob']);
$student->set_blood_group($_POST['blood_group']);
$student->set_email($_POST['email']);
$student->set_contact($_POST['contact']);
$student->set_program_id($_POST['program_id']);
$student_repository = new StudentRepository();
$result_add = 0;
$result_edit = 0;
if (!isset($_POST['id']) || $_POST['id'] == '') {
$result_add = $student_repository->insert($student);
} else {
$student->set_id($_POST['id']);
$result_edit = $student_repository->update($student);
}
if ($result_add > 0) {
header('location:student.php?success=true');
} elseif ($result_edit > 0) {
header('location:student.php?update=true');
} elseif ($result_edit == 0) {