只是为了澄清这里的所有答案都完美无缺!我选择了 Edwins,因为他第一次发布。
$this -> load -> model('staff_model');
$this -> load -> library('encrypt');
$arrData = array(
'anum' => $this -> encrypt -> encode($this->input->post('anum')),
'first' => $this -> input -> post('fname'),
'last' => $this -> input -> post('lname'),
'why' => $this -> input -> post('why'),
'aidyear' => $this -> input -> post('aidyear'),
'signintime' => NULL,
'comments' => $this -> input -> post('comments'),
);
if ($insert = $this -> staff_model -> session($arrData)) {
redirect('staff_controller/signin_info');
} else {
$this -> studentlogin();
}
模型 :
function session($arrData) {
$null = NULL;
$sql2 = "INSERT INTO session (anum, first, last, why, aidyear, signintime, studentcomments)
VALUES (?, ?, ?, ?, ?, ?, ?)";
$insert = $this -> db -> query($sql2, $arrData);
return $insert;
}