Jump to content


New Members
  • Posts

  • Joined

  • Last visited

Everything posted by yuanven

  1. Hello. Please help me because I can't get this done. This is where I input and go to controller function simpan_nilai <form method="post" action="<?php echo base_url('administrator/nilai/simpan_nilai'); ?>"> <table class="table table-striped table-hover table-bordered mt-4"> <tr> <td width="25px">NO</td> <td width="150px">NIM</td> <td>NAMA MAHASISWA</td> <td>NILAI</td> </tr> <?php $no = 1; foreach ($list_nilai as $row) : ?> <tr> <td><?php echo $no++ ?></td> <td><?php echo $row->nim; ?></td> <td><?php echo $row->nama_lengkap ?></td> <input type="hidden" name="id_krs[]" value="<?php $row->id_krs; ?>"> <td width="25px"><input type="text" name="nilai[]" class="form-control" value="<?php echo $row->nilai; ?>"></td> </tr> <?php endforeach; ?> </table> <button type="submit" class="btn btn-primary">Simpan</button> </form> This is function simpan_nilai and go to view daftar_nilai public function simpan_nilai() { $query = array(); $id_krs = $_POST['id_krs']; $nilai = $_POST['nilai']; for($i=0; $i>sizeof($id_krs); $i++) { $this->db->set('nilai', $nilai[$i])->where('id_krs',$id_krs[$i])->update('krs'); } $data = array( 'id_krs' => $id_krs ); $this->load->view('templates_administrator/header'); $this->load->view('templates_administrator/sidebar'); $this->load->view('administrator/daftar_nilai',$data); $this->load->view('templates_administrator/footer'); } This is view daftar_nilai <?php $nilai = get_instance(); $nilai->load->model('krs_model'); $nilai->load->model('mahasiswa_model'); $nilai->load->model('matakuliah_model'); $nilai->load->model('tahunakademik_model'); $krs = $nilai->krs_model->get_by_id($id_krs[0]); $kode_matakuliah = $krs->kode_matakuliah; $id_thn_ak = $krs->id_thn_ak; ?> <div class="container-fluid"> <div class="alert alert-success"> <i class="fas fa-university"></i> DAFTAR NILAI MAHASISWA </div> <table class="table table-hover table-bordered table-striped mt-3"> <tr> <td>NO</td> <td>NIM</td> <td>NAMA LENGKAP</td> <td> <?php $no = 1; for($i=0; $i<sizeof($id_krs); $i++) { ?> <tr> <td><?php echo $no++ ?></td> <?php $nim = $nilai->krs_model->get_by_id($id_krs[$i])->nim; ?> <td><?php echo $nim; ?></td> <td><?php echo $nilai->mahasiswa_model->get_by_id($nim)->nama_lengkap ?></td> <td><?php echo $nilai->krs_model->get_by_id($id_krs[$i])->nilai ?></td> </tr> <?php } ?> </td> </tr> </table> </div> And I get this error A PHP Error was encountered Severity: Notice Message: Trying to get property 'kode_matakuliah' of non-object Filename: administrator/daftar_nilai.php Line Number: 10 Backtrace: File: C:\xampp\htdocs\sisfo_akademikk\application\views\administrator\daftar_nilai.php Line: 10 Function: _error_handler File: C:\xampp\htdocs\sisfo_akademikk\application\controllers\administrator\nilai.php Line: 149 Function: view File: C:\xampp\htdocs\sisfo_akademikk\index.php Line: 315 Function: require_once Thankyou for your help!
  2. Hello! I am using PHP version 5.7 and Code Igniter 3 I have 2 tables. 1. krs 2. matakuliah this is the code $nim = $this->input->post('nim', TRUE); $thn_ak = $this->input->post('$id_thn_ak', TRUE); $query = "SELECT krs.id_thn_ak ,krs.kode_matakuliah ,matakuliah.nama_matakuliah ,matakuliah.sks ,krs.nilai FROM krs INNER JOIN matakuliah ON (krs.kode_matakuliah = matakuliah.kode_matakuliah) WHERE krs.nim = $nim AND krs.id_thn_ak = $thn_ak"; and I got an error like this A Database Error Occurred Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INNER JOIN matakuliah ON (krs.kode_matakuliah = matakuliah.kode_matak...' at line 9 SELECT krs.id_thn_ak ,krs.kode_matakuliah ,matakuliah.nama_matakuliah ,matakuliah.sks ,krs.nilai FROM krs WHERE krs.nim = 18024114 AND krs.id_thn_ak = INNER JOIN matakuliah ON (krs.kode_matakuliah = matakuliah.kode_matakuliah) Filename: C:/xampp/htdocs/sisfo_akademik/system/database/DB_driver.php Line Number: 692 Thank You.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.