I want to SUM my GPA point Column And Then I want to Division full summation with rows, from database according to my column (Class=Secession=roll). Then I will echo full Grade. Please expert brother Help me. I am still learner. Thank You to all
<?php
include 'connect.php';
$class_n =$_POST['class_n'];
$class_s =$_POST['class_s'];
$r =$_POST['roll'];
$sql="select SUM(point) AS gpa from full_result where class_n='$class_n' AND class_s='$class_s' AND roll='$r'";
$data = mysql_query($sql);
$c = $gpa / 5;
echo $c;
?>
You need to extract out the gpa
alias from your result set. In the original problem, you were using the variable $gpa
which was never assigned.
$sql="select SUM(point) AS gpa from full_result where class_n='$class_n' AND class_s='$class_s' AND roll='$r'";
$data = mysql_query($sql);
$row = mysql_fetch_assoc($data);
$gpa = $row["gpa"];
$c = $gpa / 5;
echo $c;