Can anyone help here
The code I'm using finds the total number of records
function trawl(){
$qTrawl = "SELECT * FROM feedback ";
$rTrawl = mysql_query($qTrawl);
$num = mysql_num_rows($rTrawl);
return $num;
}
calculates the percentage of a particular response to a question
function perc($criteria,$value,$total){
$qPerC = "SELECT * FROM feedback WHERE $criteria = $value";
$rPerC = mysql_query($qPerC);
$q_Num = mysql_num_rows($rPerC);
if (q_Num<1)
{
percentage = 0;
}else
percentage = ($q_Num/$total)*100
}
return $percentage;
}
these two are called on the page thus:
<?php perC("4a","Very",trawl());?>
when the page is processed I get 3 warnings two relate to the use of mysql_num_rows saying that the supplied argument is not valid the third warning is a divide by zero caused by the previous two errors.
ANy Ideas how to fix this.
THe Start of wisdom is to realise you know nothing. I must be a genius then!
The code I'm using finds the total number of records
function trawl(){
$qTrawl = "SELECT * FROM feedback ";
$rTrawl = mysql_query($qTrawl);
$num = mysql_num_rows($rTrawl);
return $num;
}
calculates the percentage of a particular response to a question
function perc($criteria,$value,$total){
$qPerC = "SELECT * FROM feedback WHERE $criteria = $value";
$rPerC = mysql_query($qPerC);
$q_Num = mysql_num_rows($rPerC);
if (q_Num<1)
{
percentage = 0;
}else
percentage = ($q_Num/$total)*100
}
return $percentage;
}
these two are called on the page thus:
<?php perC("4a","Very",trawl());?>
when the page is processed I get 3 warnings two relate to the use of mysql_num_rows saying that the supplied argument is not valid the third warning is a divide by zero caused by the previous two errors.
ANy Ideas how to fix this.
THe Start of wisdom is to realise you know nothing. I must be a genius then!