Dan13071992
12-05-2010, 12:04 AM
hello everyone, i have had alot of trouble tring to get this script to work, it is only a partial as the rest of the page does work, but what happens is, where the outputs are on the page as statistics it only shows up as a 0 this is due to the [0] that is next to some of the statistics from the php code itself however i have tried many attempts, so any help would be great.
/////////ranks///////////
/////////godfather/////////
$godfather = mysql_query("SELECT rank FROM users WHERE rank = 'Godfather'");
$totalgodfather = 0;
while($rowgodfather=mysql_fetch_array($godfather)){
$totalgodfather+=$rowgodfather[0];
}
$godfatheralive = mysql_query("SELECT rank FROM users WHERE rank = 'Godfather' AND status = 'Alive'");
$totalgodfatheralive = 0;
while($rowgodfatheralive=mysql_fetch_array($godfatheralive)){
$totalgodfatheralive+=$rowgodfatheralive[0];
}
$godfatherpercentalive = round($totalgodfatheralive / $godfather);
/////////druglord///////////
$druglord = mysql_query("SELECT rank FROM users WHERE rank = 'Druglord'");
$totaldruglord = 0;
while($rowdruglord=mysql_fetch_array($druglord)){
$totaldruglord+=$rowdruglord[0];
}
$druglordalive = mysql_query("SELECT rank FROM users WHERE rank = 'Druglord' AND status = 'Alive'");
$totaldruglordalive = 0;
while($rowdruglordalive=mysql_fetch_array($druglordalive)){
$totaldruglordalive+=$rowdruglordalive[0];
}
$druglordpercentalive = round($totaldruglordalive / $druglord);
//////////Underboss/////////
$underboss = mysql_query("SELECT rank FROM users WHERE rank = 'Underboss'");
$totalunderboss = 0;
while($rowunderboss=mysql_fetch_array($underboss)){
$totalunderboss+=$rowunderboss[0];
}
$underbossalive = mysql_query("SELECT rank FROM users WHERE rank = 'Underboss' AND status = 'Alive'");
$totalunderbossalive = 0;
while($rowunderbossalive=mysql_fetch_array($underbossalive)){
$totalunderbossalive+=$rowunderbossalive[0];
}
$underbosspercentalive = round($totalunderbossalive / $underboss);
/////////////Consigliere///////
$consigliere = mysql_query("SELECT rank FROM users WHERE rank = 'Consigliere'");
$totalconsigliere = 0;
while($rowconsigliere=mysql_fetch_array($consigliere)){
$totalconsigliere+=$rowconsigliere[0];
}
$consiglierealive = mysql_query("SELECT rank FROM users WHERE rank = 'Consigliere' AND status = 'Alive'");
$totalconsiglierealive = 0;
while($rowconsiglierealive=mysql_fetch_array($consiglierealive)){
$totalconsiglierealive+=$rowconsiglierealive[0];
}
$consiglierepercentalive = round($totalconsiglierealive / $consigliere);
///////////Capo////////////
$capo = mysql_query("SELECT rank FROM users WHERE rank = 'Capo'");
$totalcapo = 0;
while($rowcapo=mysql_fetch_array($capo)){
$totalcapo+=$rowcapo[0];
}
$capoalive = mysql_query("SELECT rank FROM users WHERE rank = 'Capo' AND status = 'Alive'");
$totalcapoalive = 0;
while($rowcapoalive=mysql_fetch_array($capoalive)){
$totalcapoalive+=$rowcapoalive[0];
}
$capopercentalive = round($totalcapoalive / $capo);
/////////end////////////
thank you in advance if you can help me out.
/////////ranks///////////
/////////godfather/////////
$godfather = mysql_query("SELECT rank FROM users WHERE rank = 'Godfather'");
$totalgodfather = 0;
while($rowgodfather=mysql_fetch_array($godfather)){
$totalgodfather+=$rowgodfather[0];
}
$godfatheralive = mysql_query("SELECT rank FROM users WHERE rank = 'Godfather' AND status = 'Alive'");
$totalgodfatheralive = 0;
while($rowgodfatheralive=mysql_fetch_array($godfatheralive)){
$totalgodfatheralive+=$rowgodfatheralive[0];
}
$godfatherpercentalive = round($totalgodfatheralive / $godfather);
/////////druglord///////////
$druglord = mysql_query("SELECT rank FROM users WHERE rank = 'Druglord'");
$totaldruglord = 0;
while($rowdruglord=mysql_fetch_array($druglord)){
$totaldruglord+=$rowdruglord[0];
}
$druglordalive = mysql_query("SELECT rank FROM users WHERE rank = 'Druglord' AND status = 'Alive'");
$totaldruglordalive = 0;
while($rowdruglordalive=mysql_fetch_array($druglordalive)){
$totaldruglordalive+=$rowdruglordalive[0];
}
$druglordpercentalive = round($totaldruglordalive / $druglord);
//////////Underboss/////////
$underboss = mysql_query("SELECT rank FROM users WHERE rank = 'Underboss'");
$totalunderboss = 0;
while($rowunderboss=mysql_fetch_array($underboss)){
$totalunderboss+=$rowunderboss[0];
}
$underbossalive = mysql_query("SELECT rank FROM users WHERE rank = 'Underboss' AND status = 'Alive'");
$totalunderbossalive = 0;
while($rowunderbossalive=mysql_fetch_array($underbossalive)){
$totalunderbossalive+=$rowunderbossalive[0];
}
$underbosspercentalive = round($totalunderbossalive / $underboss);
/////////////Consigliere///////
$consigliere = mysql_query("SELECT rank FROM users WHERE rank = 'Consigliere'");
$totalconsigliere = 0;
while($rowconsigliere=mysql_fetch_array($consigliere)){
$totalconsigliere+=$rowconsigliere[0];
}
$consiglierealive = mysql_query("SELECT rank FROM users WHERE rank = 'Consigliere' AND status = 'Alive'");
$totalconsiglierealive = 0;
while($rowconsiglierealive=mysql_fetch_array($consiglierealive)){
$totalconsiglierealive+=$rowconsiglierealive[0];
}
$consiglierepercentalive = round($totalconsiglierealive / $consigliere);
///////////Capo////////////
$capo = mysql_query("SELECT rank FROM users WHERE rank = 'Capo'");
$totalcapo = 0;
while($rowcapo=mysql_fetch_array($capo)){
$totalcapo+=$rowcapo[0];
}
$capoalive = mysql_query("SELECT rank FROM users WHERE rank = 'Capo' AND status = 'Alive'");
$totalcapoalive = 0;
while($rowcapoalive=mysql_fetch_array($capoalive)){
$totalcapoalive+=$rowcapoalive[0];
}
$capopercentalive = round($totalcapoalive / $capo);
/////////end////////////
thank you in advance if you can help me out.