Daftar dan Belajar Sekarang!

Error code igniter

foto kepoooo
27 Kontribusi 0 Coto
1 minggu yang lalu
Too few arguments to function Users::history(), 0 passed in D:\xampp3\htdocs\rent\system\core\CodeIgniter.php on line 532 and exactly 1 expected Filename: D:\xampp3\htdocs\rent\application\controllers\Users.php Line Number: 32 Backtrace: File: D:\xampp3\htdocs\rent\index.php Line: 315 Function: require_once Kira-kira error nya dimana ya om, error ini terjadi ketika saya memasukkan parameter $id ini Code nya :
Users.php : 

public function history($id)
    {

        $data['title'] = 'History Pemesanan';
        $data['history'] = $this->db->get('tb_pemesanan')->result_array();
        $data['get'] = $this->User_model->getId($id);
        $this->load->view('templates/user_header',$data);
        $this->load->view('users/history',$data);
        $this->load->view('templates/user_footer');
    }

ini View nya history.php : 

<body>

  <!-- Navigation -->
  <nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
    <div class="container">
      <a class="navbar-brand" href="index.html">Rental Car</a>
      <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
        Menu
        <i class="fas fa-bars"></i>
      </button>
      <div class="collapse navbar-collapse" id="navbarResponsive">
        <ul class="navbar-nav ml-auto">
          <li class="nav-item">
            <a class="nav-link" href="<?= base_url('Users')?>">Home</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="<?= base_url('Users/history')?>">History Pemesanan</a>
          </li>
        </ul>
      </div>
    </div>
  </nav>

  <!-- Page Header -->
  <header class="masthead" style="background-image: url('<?= base_url('assets/')?>img/rent.jpg')">
    <div class="overlay"></div>
    <div class="container">
      <div class="row">
        <div class="col-lg-8 col-md-10 mx-auto">
          <div class="site-heading">
            <h1><?= $title?></h1>
          </div>
        </div>
      </div>
    </div>
  </header>

   <!-- Daftar Pemesanan -->
   <div class="container">
          <?= $this->session->flashdata('message'); ?>
            <div class="card shadow mb-4">
              <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary">Daftar Pemesanan</h6>
              </div>
              <div class="card-body">
                <div class="row">
<?php foreach($history as $data) : ?>
<div class="col-lg-4">
          <div class="card shadow mb-4">
                <!-- Card Header - Accordion -->
                <a href="#collapseCardExample" class="d-block card-header py-3" data-toggle="collapse" role="button" aria-expanded="true" aria-controls="collapseCardExample">
                  <h6 class="m-0 font-weight-bold text-primary"><?= $data['nama']?></h6>
                </a>
                <!-- Card Content - Collapse -->
                <div class="collapse show" id="collapseCardExample">
                  <div class="card-body">
                      <h6>Kode Pelanggan : <?= $data['kd_pelanggan']?></h6>
                      <h6>Nomor Handphone : <?= $data['no_hp']?></h6>
                      <h6>Nama Mobil : <?= $data['nama_mobil']?></h6>
                      <h6>Plat Nomor : <?= $data['plat_nomor']?></h6>
                      <h6>Jenis : <?= $data['jenis']?></h6>
                      <h6>Status : <?= $data['status']?></h6>
                      <h6>Tangal Pemesanan : <?= $data['Tanggal_Pemesanan']?></h6>
                      <h6>Deskripsi : <?= $data['deskripsi']?></h6>
                      <h6>Total : Rp <?= $data['total']?></h6>
                      <a  href="<?= base_url('users/invoice/'. $data['id'])?>"  class="btn btn-outline-success">Invoice</a>
                  </div>
                </div>
              </div>
              </div>
              <?php endforeach;?>
          </div>
        </div> 
            </div>

Jawaban
foto AhmadHaidarAlbaqir
11 Kontribusi 1 Coto
1 minggu yang lalu
ini errornya sudah jelas
Too few arguments to function Users::history(),
error terjadi karena fungsi history memerlukan sebuah argument berupa $id, tapi kamu nggak ngirim argument apa" ketika memanggil fungsi Users history mungkin bisa di tambahkan di kode yang ini
<a class="nav-link" href="<?= base_url('Users/history/id-nya')?>">History Pemesanan</a>


Login untuk diksusi di forum sekolah koding