Media em PHP
Olá pessoal!
Quem pode me ajudar.?.?.?
Estou tentando pegar a média de avaliação do meu software, mas não estou conseguindo, apresenta erro de sintax.
Então, deixei o campo vazio no código abaixo.
Código MYSQL
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_bd_soft, $bd_soft);
$query_rs_pesquisa = "SELECT * FROM bd_pesquisa";
$rs_pesquisa = mysql_query($query_rs_pesquisa, $bd_soft) or die(mysql_error());
$row_rs_pesquisa = mysql_fetch_assoc($rs_pesquisa);
$totalRows_rs_pesquisa = mysql_num_rows($rs_pesquisa);
$somaRows_rs_pesquisa = mysql_PRECISO ACHAR A FUNÇÃO E COLOCAR AQUI_rows($rs_pesquisa);
?>
Aqui o código PHP
<?php echo ($somaRows_rs_pesquisa/$totalRows_rs_pesquisa)?>
O que estou fazendo de errado?
Tentei jogar direto no Select... mas também não deu.
Alguém consegue me dar uma luz?
Abraços,
Erilton
Discussão (1)
Carregando comentários...