Forum Moderators: coopster
I seen a lot of examples on using a while statement to print each row, but that is not what I am needing to do. I need to have the total result as one array that I use.
I am in PHP4
Thanks,
Mike
[EDIT] - After thinking about this some, let me describe in detail what I am trying to do.
I have a DB that has a list of fish that was caught, that was entered by a user. I do a select to get a mysql result of everything put into the species table. I then need to count how many times each species was entered, which I think I can use array_count_values. I need to end up with a result like this:
$fishcount = array ( array ( "", "Total Logged"),
array ( "Fish 1 name", 5),
array ( "Fish 1 name", 2),
array ( "Fish 1 name", 6),
array ( "Fish 1 name", 8)
);
See an example at mysql_fetch_array [php.net]
Anyways..........Using mysql_fetch_array with MYSQL_NUM, puts me with this:
Array ( [0] => Array ( [0] => Fish 1 )
[1] => Array ( [0] => Fish 2 )
[2] => Array ( [0] => Fish 3 )
[3] => Array ( [0] => Fish 2 )
[4] => Array ( [0] => Fish 3 )
) Now the problems comes in, I can't seem to use array_count_values or array_values. array_count_values throws an error saying it only counts strings and int. And array_values just displays it the same, like I posted above.