Quantcast
Channel: DaniWeb Solved Topics
Viewing all articles
Browse latest Browse all 587

What is the right way to do this

$
0
0

I have table i wish to count how many times a value appears in all column the table structure

id Subject1 Subject1score subject1grade Subject2 Subject2score subject2grade
1  English    100               A       Mathematics   100      C

HERES MY PREVIOUSLY TRIED CODE

<?php
$subject1grade='A';
$subject2grade='A';
$subject3grade='B'; $a=array("$subject1grade","$subject2grade","$subject3grade");
print_r(array_count_values($a));
?>

THE RESULT

Array ( [A] => 2 [B] => 1 )

I NEED THE CODE TO DISPLAY You made 2A(s), 1B(s)

I want to count how many A's and C's


Viewing all articles
Browse latest Browse all 587

Trending Articles