我使用了codeigniter,我有查询模型来显示数据
function get_accfotografer(){
$sql="SELECT
`artikel`.`foto_naam`,
`fotografer`.`id` AS 'fotografer_id',
`customer`.`id` AS 'customer_id',
`fotografer`.`name_fotografer`,
`customer`.`first_name`,
`customer`.`last_name`,
`fotografer`.`domain_name`,
`fotografer`.`email`,
`order`.`invoice_no`,
`order`.`order_cost`,
`order`.`total_cost`,
`order`.`invoice_date`,
`order`.`payment`,
`order`.`status`
FROM
`artikel_group`
INNER JOIN `artikel` ON `artikel`.`artikelgroup_id` = `artikel_group`.`id`
INNER JOIN `fotografer` ON `artikel_group`.`fotografer_id` = `fotografer`.`id`
INNER JOIN `order_has_artikelgroup` ON `order_has_artikelgroup`.`artikelgroup_id` = `artikel_group`.`id`
INNER JOIN `order` ON `order`.`id` = `order_has_artikelgroup`.`order_id`
INNER JOIN `customer` ON `order`.`customer_id` = `customer`.`id`
";
$row=$this->db->query($sql);
return $row;
}
然后在控制器中我使用了代码
$data['accphotografer'] = $this->M_admin->get_accfotografer()->result();
在视野中
<?php foreach ($accphotografer as $data) { ?>
<tbody>
<tr>
<td><?php echo $no; ?></td>
<td><?php echo $data->name_fotografer ?></td>
<td><?php echo $data->email ?></td>
<td><?php echo $data->domain_name ?></td>
<td><?php echo $data->first_name ?> <?php echo $data->last_name ?></td>
<td><?php echo $data->foto_naam ?></td>
<td><?php echo $data->invoice_no ?></td>
<td><?php echo $data->invoice_date ?></td>
<td><?php echo $data->order_cost ?></td>
<td><?php echo $data->total_cost ?></td>
<td><?php echo $data->payment ?></td>
<td><?php echo $data->status ?></td>
<td>
<?php echo anchor('admin/order_delete/' . $data->fotografer_id, 'Delete', array('class' => 'delete', 'onclick' => "return confirm('you sure delete?')")); ?></td>
</tr>
</tbody>
<?php $no = $no + 1; ?>
<?php } ?>
</table>
示例结果是
1 lekto jhon@yahoo.com www.jhon.com Romualdus Bimantara Pre-School_Child.jpg
dp-0413-000027 2013-04-26 200.00 0.00 contant paid Delete
2 lekto jhon@yahoo.com www.jhon.com dinda sari Pre-School_Child.jpg
dp-0413-000028 2013-04-26 145.00 0.00 contant paid Delete
3 lekto jhon@yahoo.com www.jhon.com lugas hakim Pre-School_Child.jpg
dp-0513-000030 2013-05-03 104.00 0.00 contant paid Delete
4 lekto jhon@yahoo.com www.jhon.com lugas hakim Pre-School_Child.jpg
dp-0513-000032 2013-05-03 224.00 0.00 contant paid Delete
我的问题是如果数据是相同的例子,如何显示一个数据
name | email | customer | invoice no
lekto | jhon@gmail.com | dinda sari| 001
| | | 002
| | lugas | 012
jhon | jsn@gmail.com | dinda | 013
请帮我解决这个问题