Welcome Guest, Not a member yet? Register   Sign In
Sorting multi

Not actually specific CI post but...
how can i sort $props by the value of $row['id']?
the results from db must be order by image_name but after some manipulation it need to be sorted by row[id]?
i tried usort and array_multisort with no success Sad
thanks in advance

$all_msg = $query->result_array();
  foreach ($all_msg as $row)
   if($row['parent_id'] == '0')
    $msg_item = array();
    $msg_item['id'] = $row['id'];
    $msg_item['image_name'] = 'mainBullet.gif';
    $this->props[] = $msg_item;


You can use the same index then call ksort().

$this->props[$row['id']] = $msg_item;


Theme © iAndrew 2016 - Forum software by © MyBB