0
我在應用程序中遇到問題。首先讓我告訴下面插入後無法獲得行值
$data = array(
'prjc_stno' => $studentData['Student_id'],
'prjc_roll_num' => $studentData['roll_num'],
'prjc_program_id' => $post_data['program_id'],
'prjc_year' => $year,
);
$this->db->insert('i_m_studts', $data);
$last_insert_id = $this->db->insert_id();
$data = array(
'prjc_stdnt_id' => $last_insert_id,
'prjc_course_id' => $post_data['course_id'],
'prjc_cousem_id' => $crs_semister,
'prjc_event' => $post_data['event'],
'prjc_event_year' => $year,
'prjc_stu_crs_random_id' => $studentData['random_id'],
'prjc_no_scan' => 1
);
$this->db->insert('i_studt_course', $data);
$inserted_id = $this->db->insert_id();
$this->db->trans_start();
$this->db->where('prjc_stdnt_id', $inserted_id);
$this->db->where('prjc_course_id', $post_data['course_id']);
$this->db->where('prjc_event', $post_data['event']);
$this->db->where('prjc_event_year', $year);
$query2 = $this->db->get('i_studt_course');
$student_course = $query2->result_array();
--> $prjc_stu_cou_id = $student_course[0]['prjc_stu_cou_id']; **(Line Number: 420)**
$this->db->where('prjc_stu_crs_id', $prjc_stu_cou_id);
$query1 = $this->db->get('i_m_scnbb');
$result = $query1->result_array();
代碼現在,當以往任何時候都到達 - >它創建了一個錯誤說$student_course[0]['prjc_stu_cou_id']
是空
我想知道這是爲什麼。如果不清楚,請詢問。