Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I Need A Help In PHP Code Where It Will Calculate the total ! For Example 2+2 = 4
!

In Mysql Database
HTML
<pre lang="SQL">-----------------------------------------
id   |    name     |      ratings    |
1    |    php      |        4       |
2    |    css      |        7       |
3    |    php      |        6       |
4    |    css      |        5       |
5    |    html     |        6       |
6    |    php      |        9       |
-----------------------------------------



I Need The Out Put like

PHP = Has 19 Ratings
css = Has 12 Ratings
Html = has 6 ratings

i need a pp code where it shows like this plz help me
Posted
Comments
Kornfeld Eliyahu Peter 4-Aug-15 9:10am    
Look for the SUM method of SQL...

Even though it is very basic query that you can search out on google, but to solve your problem below is the query that you need.

SQL
select name,sum(ratings) from table_name group by name
 
Share this answer
 
Okay Thank You So Much !!! ........
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900