Viewing file: da_sa_student.php (3.97 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("sa_model.php");
class Da_sa_student extends Sa_model {
// PK is std_id
public $std_id;
public $std_code;
public $std_name;
public $std_name_eng;
public $std_surname;
public $std_surname_eng;
public $std_ad_year;
public $std_admit_date;
public $std_graduate_year;
public $std_draduate_date;
public $std_total_point;
public $std_exit_exam;
public $std_honor;
public $std_medal;
public $std_gen_status;
public $std_pf_id;
public $std_cur_id;
public $std_tm_id_admit;
public $std_sy_id;
public $std_sst_id;
public $std_gen_id;
public $std_et_id;
public $std_et2_id;
public $std_pa_id;
public $std_so_id;
public $std_fs_id;
public $std_sst_id_tmp;
public $std_update_date;
public $std_update_us_login;
public $last_insert_id;
function Da_sa_student() {
parent::__construct();
$this->load->database('esa',TRUE);
}
function insert() {
// if there is no auto_increment field, please remove it
$sql = "INSERT INTO sa_student (std_id, std_code, std_name, std_name_eng, std_surname, std_surname_eng, std_ad_year, std_admit_date, std_graduate_year, std_draduate_date, std_total_point, std_exit_exam, std_honor, std_medal, std_gen_status, std_pf_id, std_cur_id, std_tm_id_admit, std_sy_id, std_sst_id, std_gen_id, std_et_id, std_et2_id, std_pa_id, std_so_id, std_fs_id, std_sst_id_tmp, std_update_date, std_update_us_login)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$this->db->query($sql, array($this->std_id, $this->std_code, $this->std_name, $this->std_name_eng, $this->std_surname, $this->std_surname_eng, $this->std_ad_year, $this->std_admit_date, $this->std_graduate_year, $this->std_draduate_date, $this->std_total_point, $this->std_exit_exam, $this->std_honor, $this->std_medal, $this->std_gen_status, $this->std_pf_id, $this->std_cur_id, $this->std_tm_id_admit, $this->std_sy_id, $this->std_sst_id, $this->std_gen_id, $this->std_et_id, $this->std_et2_id, $this->std_pa_id, $this->std_so_id, $this->std_fs_id, $this->std_sst_id_tmp, $this->std_update_date, $this->std_update_us_login));
$this->last_insert_id = $this->db->insert_id();
}
function update() {
// if there is no primary key, please remove WHERE clause.
$sql = "UPDATE sa_student
SET std_code=?, std_name=?, std_name_eng=?, std_surname=?, std_surname_eng=?, std_ad_year=?, std_admit_date=?, std_graduate_year=?, std_draduate_date=?, std_total_point=?, std_exit_exam=?, std_honor=?, std_medal=?, std_gen_status=?, std_pf_id=?, std_cur_id=?, std_tm_id_admit=?, std_sy_id=?, std_sst_id=?, std_gen_id=?, std_et_id=?, std_et2_id=?, std_pa_id=?, std_so_id=?, std_fs_id=?, std_sst_id_tmp=?, std_update_date=?, std_update_us_login=?
WHERE std_id=?";
$this->db->query($sql, array($this->std_code, $this->std_name, $this->std_name_eng, $this->std_surname, $this->std_surname_eng, $this->std_ad_year, $this->std_admit_date, $this->std_graduate_year, $this->std_draduate_date, $this->std_total_point, $this->std_exit_exam, $this->std_honor, $this->std_medal, $this->std_gen_status, $this->std_pf_id, $this->std_cur_id, $this->std_tm_id_admit, $this->std_sy_id, $this->std_sst_id, $this->std_gen_id, $this->std_et_id, $this->std_et2_id, $this->std_pa_id, $this->std_so_id, $this->std_fs_id, $this->std_sst_id_tmp, $this->std_update_date, $this->std_update_us_login, $this->std_id));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM sa_student
WHERE std_id=?";
$this->db->query($sql, array($this->std_id));
}
/*
* You have to assign primary key value before call this function.
*/
function get_by_key($withSetAttributeValue=FALSE) {
$sql = "SELECT *
FROM sa_student
WHERE std_id=?";
$query = $this->db->query($sql, array($this->std_id));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_sa_student
?>
|