[eluser]anpmtp[/eluser]
how to pic database row values without for each
i want data base values in for loop
function parent_categery($Id,$selId = 0, $sym='')
{
if($Id==0)
$gr='';
else
$gr=$sym.'>';
$this->load->database();
$this->db->select('*');
$this->db->from('categories');
$this->db->join('categories_description', 'categories_description.categories_id = categories.categories_id');
$this->db->where('parent_id',$Id);
$query=$this->db->get();
$data['Select']='Select';
$row=$query->result_array();
for($i=0; $i < $query->num_rows(); $i++)
{
$Id=$row['categories_id'];
$data[$row['categories_id']]=$gr.$row['categories_name'];
$this->parent_categery($Id,$selId, $gr);
}
if ($query->num_rows() > 0)
{
foreach($query->result_array() as $row)
{
$Id=$row['categories_id'];
$data[$row['categories_id']]=$gr.$row['categories_name'];
$this->parent_categery($Id,$selId, $gr);
}
}
return $data;
i want to use fore loop instead of foreach
plz help