hello friends

i want to sum up my table field data...my table name is fee_info and i the field i want to sum is exam_Fee...
i have come out with a query but at last i am not figuring it out yet.
here is mine code

mysql_connect("localhost","root","");
mysql_select_db("new");


$get= mysql_query("SELECT SUM(exam_fee) as total FROM fee_info");
while($getnow=mysql_fetch_assoc($get))
{

$Reg=$getnow['exam_fee'];
echo $Reg;
}
?>

please help me to solve it out...quick

Recommended Answers

All 3 Replies

Why are you getting 'exam_fee' when you called the column 'total'?

as already explained in the previous post

you are using total as an alias for SUM(exam_fee)

but trying to fetch exam_fee not total.

just use sum(fieldname) when selecting query

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.