$playernothing = 0;
$sortdrawmax = max($p1count,$player2count,$player3count,$player4count,$player5count,$player6count,$player7count);
$sortdraww = mysql_query("SELECT username,count FROM blackjackmultijoin WHERE gameid = '$gameid' AND count = '$sortdrawmax'");
while($sortdraw = mysql_fetch_array($sortdraww)){
$playernothing++;
$playersname.$playernothing = $sortdraw['username'];
}
if($sortdrawmax < 1){
$drawoutcome = "All users <b>busted</b> and the game will restart in <b>$gamedrawleft</b> seconds...";
}
elseif($playernothing == 2){
$drawoutcome = "$playersname1 and $playersname2 drew with <b>$sortdrawmax</b>! Game will restart in <b>$gamedrawleft</b> seconds...";
}
elseif($playernothing == 3){
$drawoutcome = "$playersname1, $playersname2 and $playersname3 drew with <b>$sortdrawmax</b>! Game will restart in <b>$gamedrawleft</b> seconds...";
}
I have the above code in a part of my Multiplayer Blackjack script.
My intentions is a code that will complete the $drawoutcome
above so that for each user which has the highest amount in a draw are seperated by a comma with the last name coming after "and".
Can anyone please help with the correct way of doing this?