表内容显示不正确



我有一个问题来显示未正确显示的内容:

我的名字一次又一次地显示
我的IKLAN(图像(也
但我的尺码没有一次又一遍地显示
太有趣了
像这样的eror

这是我的观点:

data.php

<thead>
<tr>
<?php $i = 1;?>
<th>Nomer</th>
<th>Nama</th>
<th>Iklan</th>
<th>Ukuran</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<tr>
<?php
$no = $this->uri->segment('3') + 1;
foreach ($list as $l) {?>
<td align="center"><h4><?php echo $i++; ?></h4></td>

<td align="center"><h4><span style="font-weight:bold"><?php echo $l->nama_client?></span></h4></td>
<td align="center"><h4><img src="./upload_iklan/<?php echo $l->iklan;?>" id="gambar_nodin" width="200"/></h4></td>
<td align="center"><h3><?php echo $l->size_ads?></h3></td>

这是我的控制器:Iklan.php

public function __construct()
{
parent::__construct();
$this->load->model('iklan_model');
$this->load->helper(array('form','url'));
$this->load->library('form_validation','upload','pagination');
$this->load->helper('url');
}
public function dashboard()
{
$data['konten'] = "dashboard";
$this->load->view('index', $data);
}
public function index($offset=0)
{
$this->load->database();
$data['list']=$this->iklan_model->show_iklan();
json_encode($data);
$this->load->library('pagination');
$config['base_url'] = base_url();
$config['total_rows'] = $data;
$config['per_page'] = 10;
$from = $this->uri->segment(3);
$this->pagination->initialize($config);     
$data['list'] = $this->iklan_model->data($config['per_page'],$from);
$this->load->view('data',$data);
}

这是我的型号:

Iklan_model.php

public function __construct()
{
parent::__construct();
}
function data($number,$offset){
return $query = $this->db->get('client,size,advertisement',$number,$offset)->result();      
}
function jumlah_data(){
return $this->db->get('data')->num_rows();
}

循环必须在标记之前开始,这样它才能用正确的数据打印每一行。

<?php
$no = $this->uri->segment('3') + 1;
foreach ($list as $l) {?>
<tr>         
<td align="center"><h4><?php echo $i++; ?></h4></td>

<td align="center"><h4><span style="font-weight:bold"><?php echo $l->nama_client?></span></h4></td>
<td align="center"><h4><img src="./upload_iklan/<?php echo $l->iklan;?>" id="gambar_nodin" width="200"/></h4></td>
<td align="center"><h3><?php echo $l->size_ads?></h3></td>
</tr>
<?php } ?>

相关内容

  • 没有找到相关文章

最新更新