I got an mysql error
An alias was previously found. (near "SUM" at position 42) this error
Mysql Query
$qry2="SELECT count(".$rows->name.") AS count, SUM (".$rows->name.") As SUM FROM module4piechart";
Here the CODE
HERE THE ERROR
Don't use keyword as alias name and follow the #San Lin Naing answer .
As per your comment error i give some clarification about that
MySQL said: Documentation #1630 - FUNCTION mydb.SUM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT count(HTML) AS count1 ,SUM(HTML) As SUM1 FROM module4piechart
MySQL does not accept spaces between function name and parenthesis (unless you have set SQL_MODE=IGNORE_SPACE but that gives you other undesirable side effects)
Use single quotes to escape the keywords
$qry2="SELECT count(".$rows->name.") AS 'count' ,SUM (".$rows->name.")As 'SUM' FROM module4piechart";