How do i execute different query using loop
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?
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?
$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);
Try this
ReplyDeleteSELECT COUNT(*) as `count`, `found_out_about_us` GROUP BY `find_out_about_us`
This software helps you customize nutrition dependant on your real age,
ReplyDeleteweight, height, and metabolism. To find out if
it is actually true and to understand better if Kyle Leon's system is generally for you or not, let's look into a few of the benefits
and drawbacks of the product. In his new program Kyle
Leon offers high quality information and offers a proven muscle
building system that has been designed by renowned
fitness models from around the world that have been adjusted and tested for a
long time in order to provide the best results.
Feel free to surf to my web site - Somanabolic Muscle Maximizer Results