Couting occurrences of each value in an array

前端 未结 3 734
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 03:56

I\'m trying to sort and splice an array, however I\'m finding it very confusing.

I have pulled my data from a mysql table:

$total = mysql_query(\"SEL         


        
3条回答
  •  感动是毒
    2021-01-17 04:34

    while($result = mysql_fetch_assoc($total))
    {
     $cst[] = $result['customer'];
     $partnumber[] = $result['partnumber'];
     $misc[] = $result['misc'];
    
     if(array_key_exists($result['misc'], $misc_num)) {
       $misc_num[$result['misc']] += 1;
     } else {
       $misc_num[$result['misc']] = 1;
     }
    }
    

    I think that should do it!

提交回复
热议问题