0

here is my code i and got this error while running it

Notice: Undefined index: Reg_no in D:\wamp\www\mohammed\geo.php on line 12

Notice: Undefined index: Reg_no in D:\wamp\www\mohammed\geo.php on line 12
mysql_connect("localhost","root","");
mysql_select_db("new");

$query= "SELECT SUM(Reg_no)+SUM(class) FROM fee_info GROUP BY Reg_no";

$result = mysql_query($query) or die(mysql_error());

// Print out result
while($row = mysql_fetch_array($result)){
//	echo "Total ". $row['Reg_no']. " = $". $row['sum(class)'];
	
	$new=$row['Reg_no'];
echo "$new";
}

Edited by extemer: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by smantscheff
0

If you do not specify an AS clause in your field content description, the row index will be the same as the content description itself.
But your query does not make sense in the first place. Test it against your database without PHP (from the command line) and you will see that you get nonsensical results.
You are selecting only one column per row SUM(Reg_no)+SUM(class) , but in your printout you refer to two columns ( Reg_no and sum(class) ) which are both not part of your select query.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.