Postingan lainnya
tampil pesan Error Number: IMSSP/-59
halo, coder saya mau tanya masalah mengenai codeigniter saya mau tampilkan record dengan query "SELECT TOP 10 * FROM MASTER_IMP ORDER BY convert(datetime,TanggalPIB,103)" pada saat saya menjalankan, muncul pesan error seperti ini;
A Database Error Occurred
Error Number: IMSSP/-59
Memory limit of 50240 KB exceeded for buffered query
SELECT * FROM "master_imp"
Filename: C:/xampp/htdocs/ci-indoasia/system/database/DB_driver.php
Line Number: 691
padahal saya jalankan query nya di model "SELECT TOP 10 * FROM MASTER_IMP ORDER BY convert(datetime,TanggalPIB,103)" tapi muncul pesan error nya terdeteksi terbaca query SELECT * FROM "master_imp"
ini sintaks MVC saya
controller;
public function master_imp()
{
$this->load->helper(array('url'));
$this->load->model('server/db1/import_statistic/model_master_imp');
$this->load->library('kode_negara'); //library buatan sendiri
$this->kode_negara->list_negara();
$this->load->library('pagination');
$config['base_url'] = base_url().'menu/master_imp';
$config['total_rows'] = $this->db->get('master_imp')->num_rows();
$config['per_page'] = 10;
$config['first_link'] = 'Pertama';
$config['last_link'] = 'Terakhir';
$config['next_link'] = 'Berikut';
$config['prev_link'] = 'Sebelum';
$config['full_tag_open'] = '<div class="text-center"><nav><ul class="pagination justify-content-center">';
$config['full_tag_close'] = '</ul></nav></div>';
$config['num_tag_open'] = '<li class="page-item disabled"><span class="page-link">';
$config['num_tag_close'] = '</span></li>';
$config['cur_tag_open'] = '<li class="page-item active"><span class="page-link">';
$config['cur_tag_close'] = '<span class="sr-only">(current)</span></span></li>';
$config['next_tag_open'] = '<li class="page-item disabled"><span class="page-link">';
$config['next_tagl_close'] = '<span aria-hidden="true">»</span></span></li>';
$config['prev_tag_open'] = '<li class="page-item disabled"><span class="page-link">';
$config['prev_tagl_close'] = '</span></li>';
$config['first_tag_open'] = '<li class="page-item disabled"><span class="page-link">';
$config['first_tagl_close'] = '</span></li>';
$config['last_tag_open'] = '<li class="page-item disabled"><span class="page-link">';
$config['last_tagl_close'] = '</span></li>';
//class disabled untuk menonaktifkan
$from = $this->uri->segment(3);
$this->pagination->initialize($config);
$data['hasil'] = $this->model_master_imp->tampil_data($config['per_page'],$from);
$this->load->view('server/db1/import_statistic/master_imp', $data);
}
model;
class Model_master_imp extends CI_Model
{
function tampil_data(){
$this->load->database('sqlsrv_import_statistic', TRUE);
$sql = "SELECT TOP 10 * FROM MASTER_IMP ORDER BY convert(datetime,TanggalPIB,103)";
$kueri = $this->db->query($sql);
return $kueri;
}
view;
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Indo Asia | Tabel MASTER_IMP</title>
<?php include 'application/views/komponen/header.php'; //meta, css, js ?>
</head>
<body>
<?php include 'application/views/komponen/navbar.php'; //navbar ?>
<div class="container text-center">
<div class="row content">
<div class="col-sm-12 text-left">
<h2>Tabel MASTER_IMP</h2>
<hr>
<form class="form" action="<?php echo base_url() ?>menu/cari_master" method="POST">
<div class="form-row">
<div class="form-group col-md-2">
<label for="label_hs">HS:</label>
<input type="text" class="form-control form-control" name="hs" placeholder="Kode HS" />
</div>
<div class="form-group col-md-4">
<label for="label_importir">Importir:</label>
<input type="text" class="form-control form-control" name="importir" placeholder="Nama Importir" />
</div>
<!--datepicker awal-->
<div class="form-group col-md-2">
<label for="label_tglawal">Tanggal Awal:</label>
<div class="input-daterange" id="datepicker">
<input type="text" class="form-control form-control" name="tglawal" placeholder="MM/DD/YYYY" />
</div>
</div>
<div class="form-group col-md-2">
<label for="label_tglakhir">Tanggal Akhir:</label>
<div class="input-daterange" id="datepicker">
<input type="text" class="form-control form-control" name="tglakhir" placeholder="MM/DD/YYYY" />
</div>
</div>
<!--datepicker akhir-->
</div>
<button type="submit" class="btn btn-primary" id="tabel" value="cari">Cari</button>
</form>
<br />
<div class="table-responsive">
<table class="table table-hover table-bordered">
<thead class="thead-dark">
<tr>
<th>No</th>
<th>NoPengajuan</th>
<th>TanggalPIB</th>
<th>TanggalBLAWB</th>
<th>PelabuhanAsal</th>
<th>PelabuhanTujuan</th>
<th>NPWP</th>
<th>Importir</th>
<th>AlamatImportir</th>
<th>PPJK</th>
<th>AlamatPPJK</th>
<th>Pemasok</th>
<th>AlamatPemasok</th>
<th>NegaraPemasok</th>
<th>HS</th>
<th>UraianBarang</th>
<th>Quantity</th>
<th>KodeSatuan</th>
<th>Berat</th>
<th>HargaCIF</th>
<th>MataUang</th>
</tr>
</thead>
<?php
$no=1;
foreach($hasil->result() as $baris)
{
?>
<tbody>
<tr>
<td align="right"><?php echo number_format($no++,0,",",".")?></td>
<td><?php echo $baris->NoPengajuan; ?></td>
<td><?php echo $baris->TanggalPIB; ?></td>
<td><?php echo $baris->TanggalBLAWB; ?></td>
<td><?php echo $baris->PelabuhanAsal; ?></td>
<td><?php echo $baris->PelabuhanTujuan; ?></td>
<td><?php echo $baris->NPWP; ?></td>
<td><?php echo $baris->Importir; ?></td>
<td><?php echo $baris->AlamatImportir; ?></td>
<td><?php echo $baris->PPJK; ?></td>
<td><?php echo $baris->AlamatPPJK; ?></td>
<td><?php echo $baris->Pemasok; ?></td>
<td><?php echo $baris->AlamatPemasok; ?></td>
<td><?php echo strtoupper($this->kode_negara->list_negara($baris->NegaraPemasok)); ?></td>
<td><?php echo $baris->HS; ?></td>
<td><?php echo $baris->UraianBarang; ?></td>
<td align="right"><?php echo number_format($baris->Quantity,0,",","."); ?></td>
<td><?php echo $baris->KodeSatuan; ?></td>
<td align="right"><?php echo number_format($baris->Berat,0,",","."); ?></td>
<td align="right"><?php echo number_format($baris->HargaCIF,2,",","."); ?></td>
<td><?php echo $baris->MataUang; ?></td>
</tr>
</tbody>
<?php
}
?>
</table>
</div>
<?php
echo '<p>'.$this->db->count_all_results('galic'/*nama tabel*/).' record(s) ditampilkan</p>';
echo $this->pagination->create_links();
?>
</div>
</div>
</div>
<?php include 'application/views/komponen/footer.php'; //footer ?>
</body>
</html>
mohon bantuannya terima kasih
1 Jawaban:
Coba ubah saat query gan:
with LIMIT
$this->db->limit(1);
$query = $this->db->get('my_table');
$myRow = $query->row();
with OFFSET and LIMIT
$query = $this->db->get('mytable', 0, 1);
$myRow = $query->row();
sumber: https://stackoverflow.com/questions/1630109/select-top-1-equality-for-codeigniter/1633166