Data yang tampil tidak sesuai dengan jumlah count data di database codeigniter

saya memiliki tabel stdevice yg berisi data stok. saya menampilkan data menggunakan left join dari beberapa tabel. keseluruhan data saat di count 3595. namun data yang tampil di stok hanya 2900. kira2 masalah nya dimana ya kenapa data nya ada yang tidak tampil? mohon bantuannya mas mbak..

ini controllernya..

//menampilkan stok
public function stocks()
	{
		$data['stocks'] = $this->Model_count->leftjoin();
		$data['count'] = $this->Model_count->count();
		$this->load->view('admin/device_stocks', $data);
	}

ini modelnya..

//model untuk menampilkan stok
public function leftjoin(){
		$this->db->select('*');
		$this->db->from('stdevice');
		$this->db->join('device_name','stdevice.dev_id=device_name.device_name');
		$this->db->join('device_cat','stdevice.cat_id=device_cat.cat_id');
		$this->db->join('dev_type','stdevice.dev_model=dev_type.type_id');
		$this->db->join('dev_mark','dev_type.id_mark=dev_mark.mark_id');
		$this->db->join('location_details','stdevice.id=location_details.id');
		$this->db->join('stlocation','location_details.stdev_id=stlocation.stdev_id');
		$this->db->join('dev_group_info','stdevice.id=dev_group_info.id');
		$this->db->join('dev_group','dev_group_info.stdev_id=dev_group.stdev_id');
		$this->db->order_by('stdevice.id','desc');

		$query = $this->db->get();
 		return $query->result();
	}

public function count(){
		$this->db->select('*');
		$this->db->from('stdevice');
		$query = $this->db->get();
 		return   $query->num_rows();
	}

ini viewnya..

 <thead>
				<tr>
					<th class="empty"></th>
					<th>Nama Barang</th>
					<th>Tipe</th>
					<th>Merk</th>
					<th>Kategori</th>
					<th>Serial</th>
					<th>MAC</th>
					<th>Gol</th>
					<th>Lokasi</th>
					<th>Kondisi</th>
					<th class="empty"></th>
			</tr>
		</thead>
<tbody>
<!-----------------------------------Content------------------------------------>
<?php foreach ($stocks as $row) : ?>
	<tr>
	<td><?php
		       if($row->dev_status=='New')
		       { echo '<i class="icon-check"></i><div id="hide"><strong>'.$row->dev_status.'</strong></div>'; }
		       else if($row->dev_status=='Used')
			   {echo '<i class="icon-ok"></i><div id="hide"><strong>'.$row->dev_status.'</strong></div>'; }
			   else if($row->dev_status=='Repaired'){
			   echo '<i class="icon-wrench"></i><div id="hide"><strong>'.$row->dev_status.'</strong></div>'; }
		       else{
			   echo '<i class="icon-remove-sign"></i><div id="hide"><strong>'.$row->dev_status.'</strong></div>'; }; ?>
		</td>
		<td><?php echo $row->dev_name ?></td>
		<td><?php echo $row->tipe ?></td>
		<td><?php echo $row->merk ?></td>
		<td><?php echo $row->device_cat ?></td>
		<td><?php echo $row->dev_serial?></td>
		<td><?php echo $row->dev_mac?></td>
		<td><?php echo $row->dev_group_name?></td>
		<td><?php echo $row->stdev_location_name ?></td>
		<td><?php
		       if($row->dev_status=='New'){
			   echo '<div class="alert alert-success"><i class="icon-check"></i><strong>'.$row->dev_status.'</strong></div>'; }
		       else if($row->dev_status=='Used'){
			   echo '<div class="alert alert-warning"><i class="icon-ok"></i><strong>'.$row->dev_status.'</strong></div>'; }
			   else if($row->dev_status=='Repaired') {
			   echo '<div class="alert alert-warning"><i class="icon-wrench"></i><strong>'.$row->dev_status.'</strong></div>'; }
		       else{
			   echo '<div class="alert alert-danger" width="60"><i class="icon-remove-sign"></i><strong>'.$row->dev_status.'</strong></div>'; };
			  ?></td>
avatar venny23
@venny23

9 Kontribusi 2 Poin

Dipost 5 tahun yang lalu

Tanggapan

boleh sertakan juga gambar dari database yang ada ?

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban