Here is the data I have:
ID | Name | Family
 1 | John | Doe
 2 | Jane | Doe
 3 | John | Man
 4 | Jane | Blah
Basically what I am trying to do is group them by Family. I am getting the data inside a while statement and I just tried using array and array_push but that doesn't work at all.
Any ideas or suggestions on how to do this?
I am going to ouput this data for jquery for creating optgroups which would be grouped by Family. Currently here is what is happening:
while ($orders_status = tep_db_fetch_array($orders_status_query)) {
    $status_id = $orders_status['orders_status_id'];
    $status_name = $orders_status['orders_status_name'];
    $status_group = $orders_status['orders_status_group'];
}
That's the basic code. I tried doing this to the above mentioned co开发者_Python百科de:
while ($orders_status = tep_db_fetch_array($orders_status_query)) {
    $status_id = $orders_status['orders_status_id'];
    $status_name = $orders_status['orders_status_name'];
    $status_group = $orders_status['orders_status_group'];
    echo 'if (currentOption.val() == "' . $status_id . '") {
              var optgroup = $("<optgroup/>");
              optgroup.attr("label", "' . $status_group . '");
              currentOption.wrapAll(optgroup);
          }
    ';
 }
What that did is basically created multiple Family of Doe. Instead I would like to somehow create only one Family of Doe and push Name and ID into it
$groups = array();
foreach ($rows as $row) {
  $family = $row["family"];
  if (empty($groups[$family])) $groups[$family] = array();
  $groups[$family] []= $row;
}
// $groups["Doe"] will have the two relevant rows...
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论