\r\n"; $total=0; $i=0; $counter=0; $playersfirstname = array(); $playersmiddlename = array(); $playerslastname = array(); $playersaname = array(); $numberedcards = array(); $rowfontcolor="#FFEB85"; $connid = mysql_connect ('localhost' , 'rastrono' , 'sinhosejar'); mysql_select_db ("rastrono_numbers"); $masterquery = "SELECT aname FROM Numbertable"; $aname=mysql_query($masterquery); while($row = mysql_fetch_array($aname)){ $aname2=$row['aname']; $query = "SELECT COUNT(fullname), aname, firstname, middlename, lastname FROM cardtable WHERE fullname REGEXP '\/[0-9]*)' AND aname = '$aname2'"; $sumtotal=mysql_query($query); while($row2 = mysql_fetch_array($sumtotal)){ $grandtotal= $row2['COUNT(fullname)']; $firstname=$row2['firstname']; $middlename=$row2['middlename']; $lastname=$row2['lastname']; $fuckinganame = $row2['aname']; $firstname=str_replace(" ^","",$firstname); $lastname=str_replace(" ^","",$lastname); $middlename=str_replace(" ^","",$middlename); $firstname=str_replace("^ ","",$firstname); $lastname=str_replace("^ ","",$lastname); $middlename=str_replace("^ ","",$middlename); $firstname= ucwords(strtolower($firstname)); $lastname= ucwords(strtolower($lastname)); $middlename= ucwords(strtolower($middlename)); if (rtrim(ltrim($firstname))=="Ja") {$firstname="JA";} if (rtrim(ltrim($firstname))=="Jb") {$firstname="JB";} if (rtrim(ltrim($firstname))=="Jc") {$firstname="JC";} if (rtrim(ltrim($firstname))=="Jd") {$firstname="JD";} if (rtrim(ltrim($firstname))=="Jr") {$firstname="JR";} if (rtrim(ltrim($firstname))=="Tj") {$firstname="TJ";} if ($lastname=="") {$lastname=$firstname;} $lastname="xz".$lastname; if (strpos($lastname,"Mc") !="") { $mcpos=strpos($lastname,"Mc"); $lettertoupper = substr($lastname,$mcpos+2,1); $lastname = substr_replace($lastname,strtoupper($lettertoupper),$mcpos+2,1); } $lastname=str_replace("xz","",$lastname); } if ($grandtotal > 0) { $i++; $playersfirstname[$i]= $firstname; $playersmiddlename[$i]=$middlename; $playersmiddlename[$i]= str_replace("triple","Triple",$playersmiddlename[$i]); $playerslastname[$i]=$lastname; $playerslastname[$i]= str_replace("#209;","ntilde;",$playerslastname[$i]); $playerslastname[$i]= str_replace("-astros","-Astros",$playerslastname[$i]); $numberedcards[$i] = $grandtotal; $playersaname[$i] = $aname2; } } if ($sortorder=="playerlastname") { array_multisort($playerslastname,SORT_ASC,$numberedcards,SORT_DESC,$playersfirstname,$playersmiddlename,$playersaname); $inputvalue="Click to Re-sort by Number of Cards"; } else { array_multisort($numberedcards,SORT_DESC,$playerslastname,SORT_ASC,$playersfirstname,$playersmiddlename,$playersaname); $inputvalue="Click to Re-sort by Player Last Name"; $sortorder = "numberofcards"; } echo "
|
|
"; echo "
-- Of the ".number_format($cardsum)." cards in the Astroland collection, ".number_format($counter)."/".number_format($cardsum).", or 1 in ".number_format($cardsum/$counter,1).", are numbered | "; $playersquery="SELECT COUNT(aname) FROM Numbertable WHERE trim(aname) != ''"; $playertotal=mysql_query($playersquery); while($rowwhatever = mysql_fetch_array($playertotal)){ $playerstotal= $rowwhatever['COUNT(aname)'];} echo "
-- Of the ".number_format($playerstotal)." players in the Astroland collection, ".number_format($i)."/".number_format($playerstotal).", or 1 in ".number_format($playerstotal/$i,1).", have a numbered card | "; echo "
-- Among the ".number_format($i)." players in the Astroland collection with numbered cards, the average number of numbered cards per player is ".$i."/".$counter.", or ".number_format($counter/$i,1)." | ";
if ($sortorder=="playerlastname") {if ($i%2==0) {$median=$numberedcards[$i/2];} else {$median=($numberedcards[floor($i/2)]+$numberedcards[ceil($i/2)])/2;}
echo "
-- That\'s skewed a little bit, because of ".$playersfirstname[0]." ".$playersmiddlename[0]." ".$playerslastname[0]." and ".$playersfirstname[1]." ".$playersmiddlename[1]." ".$playerslastname[1]." and the rest. The median as you can see is ".$median." | ";} else {$topguy=max($numberedcards); $topguykey = array_search($topguy,$numberedcards); rsort($numberedcards); $middle = round(count($numberedcards) / 2); $total = $numberedcards[$middle-1]; echo "
-- That\'s skewed a bit, because of ".$playersfirstname[$topguykey]." ".$playersmiddlename[$topguykey]." ".$playerslastname[$topguykey]." and the rest of the stars with the very most cards. The median for the ".$i." is ".$total." | ";} echo "