【发布时间】:2019-04-30 12:56:29
【问题描述】:
我有 2 个表数据库:
1.table 类别
2.table 基于这些类别的选项。
我想创建基于类别的选择组。
我的代码:
function config_cat($idVps){
$this->db->select("*");
$this->db->from("tbcategory_config as a");
$this->db->join("tbconfig_option as b", "a.id_category = b.id_category");
$this->db->where("id_vps",$idVps);
$hasil = $this->db->get();
return $hasil;
}
<?php foreach($configcat->result_array() as $row):
$category =$row['name'];
$detailCon =$row['detail_config'];
?>
<div class="form-group col-md-12">
<label><?php echo htmlentities($category, ENT_QUOTES, 'UTF-8'); ?></label>
<select>
<option><?php echo htmlentities($detailCon, ENT_QUOTES, 'UTF-8'); ?></option>
</select>
</div>
<?php endforeach; ?>
我希望输出将显示选择选项 “升级内存”= 1. 1Gb, 2. 2Gb
和
“升级核心”= 1 个核心
但实际结果是升级内存显示两次 (根据上面的第三张图)
【问题讨论】:
-
@u_mulder 我在插入代码时遇到了麻烦,但我已经修复了它。谢谢。
标签: php codeigniter