【发布时间】:2020-07-15 10:37:00
【问题描述】:
我有一个数据库类别表,有 3 个字段 id,name,cate 。我把它放入数组中
$select = $this->db->get_where('cate',array('cate >'=> 0))->result_array();
我想写一个foreach
if (cate == 1) : This is the main menu
else if (cate == main menu id) : this is subcategory
这是我尝试过的
foreach ($select as $key => $value) {
$id = $value['id'];
$name = $value['name'];
$cate = $value['cate'];
}
对不起我的英语不好
【问题讨论】:
标签: php mysql arrays codeigniter