コード例 #1
0
function crosstable($id) {

global $MSG_LANG;

$t = mysql_fetch_array(mysql_query("SELECT * FROM tournaments WHERE id = '$id'"));

$name = db_output($t['name']);
$date = date("m.d.y", $t['time']);

$i = 1;

$query = mysql_query("SELECT * FROM games WHERE tournament = '$id' ORDER BY gameID ASC");

while ($g = mysql_fetch_array($query))
{

$games[$i] = $g;

$i++;

} // while

$p1 = mysql_fetch_array(mysql_query("SELECT * FROM {$db_prefix}players WHERE player_id = '".$t['player1']."'"));
$p2 = mysql_fetch_array(mysql_query("SELECT * FROM {$db_prefix}players WHERE player_id = '".$t['player2']."'"));
$p3 = mysql_fetch_array(mysql_query("SELECT * FROM {$db_prefix}players WHERE player_id = '".$t['player3']."'"));
$p4 = mysql_fetch_array(mysql_query("SELECT * FROM {$db_prefix}players WHERE player_id = '".$t['player4']."'"));

//print_r($games);

?>

<table border="1" style="width: 100%">
<tr>
<td>
<h1><?=$name?></h1><br>
<?=$MSG_LANG["start"]?>: <?=$date?>
<br>
<br>

<table width="500">

<tr>
<td width="100" height="100">&nbsp;</td>
<td width="100" height="100"><b><?PHP echo "<a href=\"stats_user.php?cod=" . $p1['playerID'] . "\">" . $p1['firstName'] . "</a>"; ?></b></td>
<td width="100" height="100"><b><?PHP echo "<a href=\"stats_user.php?cod=" . $p2['playerID'] . "\">" . $p2['firstName'] . "</a>"; ?></b></td>
<td width="100" height="100"><b><?PHP echo "<a href=\"stats_user.php?cod=" . $p3['playerID'] . "\">" . $p3['firstName'] . "</a>"; ?></b></td>
<td width="100" height="100"><b><?PHP echo "<a href=\"stats_user.php?cod=" . $p4['playerID'] . "\">" . $p4['firstName'] . "</a>"; ?></b></td>
</tr>

<tr>
<td width="100" height="100"><b><?PHP echo "<a href=\"stats_user.php?cod=" . $p1['playerID'] . "\">" . $p1['firstName'] . "</a>"; ?></b></td>
<td width="100" height="100">&nbsp;</td>
<td width="100" height="100"><b><?PHP show_game(4, $games); ?></b></td>
<td width="100" height="100"><b><?PHP show_game(7, $games); ?></b></td>
<td width="100" height="100"><b><?PHP show_game(10, $games); ?></b></td>
</tr>

<tr>
<td width="100" height="100"><b><?PHP echo "<a href=\"stats_user.php?cod=" . $p2['playerID'] . "\">" . $p2['firstName'] . "</a>"; ?></b></td>
<td width="100" height="100"><b><?PHP show_game(1, $games); ?></b></td>
<td width="100" height="100">&nbsp;</td>
<td width="100" height="100"><b><?PHP show_game(8, $games); ?></b></td>
<td width="100" height="100"><b><?PHP show_game(11, $games); ?></b></td>
</tr>

<tr>
<td width="100" height="100"><b><?PHP echo "<a href=\"stats_user.php?cod=" . $p3['playerID'] . "\">" . $p3['firstName'] . "</a>"; ?></b></td>
<td width="100" height="100"><b><?PHP show_game(2, $games); ?></b></td>
<td width="100" height="100"><b><?PHP show_game(5, $games); ?></b></td>
<td width="100" height="100">&nbsp;</td>
<td width="100" height="100"><b><?PHP show_game(12, $games); ?></b></td>
</tr>

<tr>
<td width="100" height="100"><b><?PHP echo "<a href=\"stats_user.php?cod=" . $p4['playerID'] . "\">" . $p4['firstName'] . "</a>"; ?></b></td>
<td width="100" height="100"><b><?PHP show_game(3, $games); ?></b></td>
<td width="100" height="100"><b><?PHP show_game(6, $games); ?></b></td>
<td width="100" height="100"><b><?PHP show_game(9, $games); ?></b></td>
<td width="100" height="100">&nbsp;</td>
</tr>

</table>

</td>
</tr>
</table>

<?PHP

}
コード例 #2
0
ファイル: game_inside.php プロジェクト: JJLindsay/webDevGame
    $query = $dbc->query($sql);
    $fetch = $query->fetch_assoc();
    $id = $fetch['id'];
    /* Show game */
    if ($query->num_rows) {
        show_game($id);
    }
} elseif ($busy) {
    /* Get game id */
    $sql = "SELECT * FROM games WHERE (player1='{$login_id}' OR player2='{$login_id}') AND (status!=6)";
    $query = $dbc->query($sql);
    $fetch = $query->fetch_assoc();
    $id = $fetch['id'];
    /* show game */
    if ($query->num_rows) {
        show_game($id);
    } else {
        echo "<div class='col-xs-12 text-center'>\n                Marked as BUSY!\n                <button class='btn btn-info btn_unbusy btn-lg btn-block'>Click here if you are ready to play!</button>\n            </div>";
        echo "<script>\n                \$('#badge-s').html({$score});\n                \$('#badge-sc').html(0);\n                \$('#badge-ps').html({$score});\n                \$('#badge-as').html({$avg});\n            </script>";
    }
}
?>
<script>
$('.btn_co').click(function(){
    var gid = $('#game_id').val();
    $.post( "decision.php", { id: gid, de: 1 } );
    get_data();
});
$('.btn_de').click(function(){
    var gid = $('#game_id').val();
    $.post( "decision.php", { id: gid, de: 2 } );