Snippet >> PHPFabase >> Member & Country Ratio

This snippet will take the number of members that your fanlisting has with the number of countries and create a ratio: Members to Countries. Say your fanlisting has 360 members and 36 countries, the ratio would print out to be 10:1. I just remember someone saying that they wanted to make something like this. I am trying to figure out how to make it so that the number of digits after the decimal can be changed and shortened… I will when I feel like it. It only works if you use PHPFanbase.

<b>Member/Country ratio</b>: <? include(“config.php”);
$query1=”SELECT * FROM $table WHERE apr=’y'”;
$result1=mysql_query($query1);
$num1=mysql_numrows($result1);
$query2=”SELECT DISTINCT country FROM $table WHERE apr=’y'”;
$result2=mysql_query($query2);
$num2=mysql_numrows($result2);
if($num2 != 0) {
$ratio = ($num1 / $num2);
print”$ratio:1″;
} else {
print”0:0″;}
?>


Page Views: 8 views

Leave a Reply

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif 

CommentLuv badge