I am trying to use an associative array to pass names and scores to a JPgraph but I believe I may misunderstand something about associative arrays.
Say I have an array called $kidscores where
$kidscores=(Johnny_Jones => 50, Sally_Smith => 100, Tommy_TheCat =>75)
When I pass the $kidscores variable to JPgraph, and try to....
Foreach ($kidscores as $key => $value)
{
$data_scores[] = $value;
$data_labels[] = $key;
}
...the $data_scores array works out fine, but the $data_labels array does not. It only works if I change the kid names to ID numbers...which is not what I want.
I also want to asort the $kidscores array so that the scores get ordered from lowest to highest before displaying in the graph, but it appears that that wipes out the string values (the names) and replaces them with a numeric index.
I think I'm not understanding something here....