database problem in php?

Mit Chauhan

New member
hello .. m working with phpmyadmin(mysql) using php .. using wamp server ..

and m working with avg( ) keyword in mysql .. but it seems to be not working for me ..

here is my code ..

-------------------------------------------------
<?php

mysql_connect("localhost","root","");
mysql_select_db("alldatabase");
$qry = "select avg(amount) from another";
$rs = mysql_query($qry);
while($rows = mysql_fetch_array($rs))
{
echo "The Average Age is : " . $rows["amount"];
}

?>
------------------------------------------------

the error m getting is
--------------------------
Notice: Undefined index: amount in C:\wamp\www\mysql more programmes\using AVG() keyword.php on line 18
--------------------------

well .. i have "amount" into my database .. yet m getting this error ..

and m getting this error when m using these functions
MIN(), MAX() , SUM() , AVG()

and secondly i have made my "amount" in INT only .. and if i m using this without these fourr keywords , its working fine like fetching values and etc ..

tell me why m getting ths error .. whts wrong here m doing ..

thank you ..
 
Back
Top