gpt4 book ai didi

php - Codeigniter 为列中的每个不同值填充动态链接

转载 作者:行者123 更新时间:2023-11-29 18:06:31 26 4
gpt4 key购买 nike

我成功地列出了表格中某一列的不同值(这是模型)

$this->db->select('Uo2_Lot_No');
$this->db->distinct();
$query = $this->db->get('consignment');
return $result = $query->result_array();

我可以在我的 View 上查看不同的值

<?php foreach($get_consignment as $row): ?><tr>
<td><a href="<?= base_url('admin/consignment1/con_table/' .$row['Uo2_Lot_No']); ?>"><?= $row['Uo2_Lot_No']; ?></a></td>

<?php endforeach; ?>
</tr>

在上面查看每个不同的值或链接。我怎样才能实现这个。通过单击每个不同值链接,它应该从表中获取所有适当的不同值和其他字段。

最佳答案

你的问题不太清楚

您不能在此页面上运行另一个查询吗..

您的页面 Controller /admin/consignment1/con_table/uo2_lot_no

$uo2_lot_no = $this->uri->segment(4);

$data = $this->db->select('*')->from('consignment')
->where('uo2_lot_no', $uo2_lot_no)->get()->result_array();

关于php - Codeigniter 为列中的每个不同值填充动态链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47774827/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com