Eski Öğrenci, Yeni Öğrenci, Transfere olan öğrencinin kayıt durumuna ilişkin hata mesajı koymakta sorun yaşıyorum. Öğrenci durumunu girdiğimde veya tekrar eklediğimde, bire bir ilişki olduğu için yinelenen giriş nedeniyle hata olacaktır, bu yüzden form doğrulaması gibi bir ileti ayarlamam gerekiyor, ancak yine de hata girişinde hata olacaktır. Burada Kodlayıcı kullanarak zaten girilen veri eklerken uyarı mesajı
benim denetleyicisi olduğu: burada
resimdirfunction enrollstudent(){
if($this->session->userdata('logged_in'))
{
$this->output->set_header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
$this->output->set_header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0');
$this->output->set_header('Cache-Control: post-check=0, pre-check=0', FALSE);
$this->output->set_header('Pragma: no-cache');
$session_data = $this->session->userdata('logged_in');
$data['Username'] = $session_data['Username'];
$this->load->view('StudentEnroll', $data);
} else{
redirect('welcome', 'refresh');
}
if((!isset($session_data) || $session_data !=TRUE)) {
redirect('welcome', 'refresh');
}
}
function addstatusofenroll($id){
$this->form_validation->set_rules('status', 'Status', 'callback_status_check');
if($this->form_validation->run() == FALSE)
{
$this->enrollstudent();}
else{
$data= array(
'Id'=> $id ,
'Statusofenrollment' => $this->input->post('status')
);
$this->db->insert('statusofenrollment',$data);
$this->session->set_flashdata('category_success', 'Successfully Add!');
$this->load->view('StudentEnroll');
}
}
public function callback_status_check($roll)
{
$this->db->where('Id', $roll);
$query = $this->db->get('statusofenrollment');
$count_row = $query->num_rows();
if ($count_row > 0)
{
echo 'Data Already exist';
$this->session->set_flashdata('warning', 'Data already exists');
return FALSE;
}
else
{
return TRUE;
}
}
Geri arama yönteminiz 'status_check' olmalıdır. [Docs] 'u (https://codeigniter.com/userguide3/libraries/form_validation.html#callbacks-your-own-validation-methods) kontrol edin. – Tpojka
hala aynı, bu hata yinelenen özür dilerim efendim –
neden bu gerçek dönecek? –