Hi guys,I just started learning PHP. I'm trying to retrieve the number of counts a value have.
Example my I have a field called "find_out_about_us" which stores different value like friends,social_media,search_engine. So lets say i got 5 rows of friends found in that column so my sql query will return me a value of 5.
Now my problem is... i need to count the value for different values. like i got friends,social_media,search_engine and a lot more.. How do i automate this process?? Instead of keep manually editing the where clause value?
Here is my query:
Code:$count_query = "SELECT COUNT(`find_out_about_us`) AS counted FROM polls WHERE `find_out_about_us` = 'friends' "; $result = mysqli_query($link, $count_query) or die(mysqli_error($link)); $count_result = mysqli_fetch_array($result);