AVG mysql php error: mysql_fetch_array() expects parameter 1 to be resourc -
AVG mysql php error: mysql_fetch_array() expects parameter 1 to be resourc -
i'm tryig avg column "valor_premio", have error:
warning: mysql_query() expects parameter 1 string, resource given in /home/u566181585/public_html/index.php on line 61 warning: mysql_fetch_array() expects parameter 1 resource, null given in /home/u566181585/public_html/index.php on line 63 and first echo returns that:resource id #13
$sel2 = mysql_query( "select avg(valor_premio) avg_valor novaaaa categoria='identidade'") or (mysql_error()); echo $sel2; $media_ident2=mysql_query($sel2); echo $media_ident2; $media_ident = mysql_fetch_array($media_ident2); echo $media_ident; what wrong? how can avg?
$media_ident2=mysql_query($sel2); ^^^^^
$sel2 result handle of previous mysql_query() call. cannot utilize result handle that. must provide string containing sql parameter.
what want is
$sql = "select ..."; // note: **no** mysql_query() call... $result = mysql_query($sql) or die(mysql_error()); php mysql average
Comments
Post a Comment