category_id name parent_id Action
1 pranav 0 Edit
2 shah 1(pranav) Edit
3 bugle 2(shah) Edit
我想在codeigniter中显示名称,而不是父ID。
答案 0 :(得分:0)
<td><?php echo $cat->parent_id; ?>
<?php foreach ($category as $child): ?>
if($cat->parent_id == $child->category_id)
{
echo $child->name;
break;
}
<?php endforeach; ?>