Counting Total Data

Is there a way that I can count the total data that i have? example is that, I have a student table and in a student table there is a student_gender.

The thing is I want to count all the female gender that I have, and if possible i want to post it in a page thanks

You could use this -


$countFemale = Student::model()->countByAttributes(array('student_gender' => 'female'));

echo $countFemale;

This code assumes that Student is an Active Record class for your student db table.