意外的文件结束 - 无法找到修复程序

时间:2016-05-07 14:25:20

标签: php

我收到此错误,但我无法弄清楚错误是什么。

  

(!)解析错误:语法错误,第97行的currentgame.php文件的意外结束

  呼叫堆栈
  #时间记忆功能位置
  1 0.0005 235808 {main}()... \ index.php:0

代码

<?php
if(!isset($_SESSION['steamid'])) {
    echo "<br><br>";
    } else {
        include 'includes/creategame.php';
    }
?>

<div class="container">
    <div class="content">
    <!--- <button type="button" class="btn btn-default" onClick="CreateGame();" value="Create">Create game</button> --->

        <div class="table">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Player</th>
                        <th>Bet amount</th>
                        <th>Picked</th>
                        <th>Joinable</th>
                    </tr>
                </thead>
                <tbody>
                <?php

                // The function
                class getGames {
                    public function getInformation(){
                        global $odb;

                        $query = $odb -> prepare("SELECT * FROM `ongoing` ORDER BY bet1 DESC");
                        $query -> execute();
                        return $query -> fetchAll();
                    }
                }

                $ongoing = new getGames;
                $getongoing = $ongoing->getInformation();

                foreach ($getongoing as $loop) {
                    echo "<tr>";
                    echo "<td>" . $loop['id'] . "</td>";
                    echo "<td>" . $loop['player1'] . "</td>";
                    echo "<td>" . "$" . $loop['bet1'] . "</td>";
                    echo "<td>" . '<html><img src="images/'.$loop['site1'].'.png" width="25" height="25"/></html>' . "</td>";
                    // Knap med "JOIN GAME" funktion. 
                    echo '<td><button type="button" class="btn btn-link" onClick="joinGame(' . $loop['id'] . ');" id="test">Join game</button></td></tr>';

                    $myfile = fopen ('games/' . $loop['id'] . '.php', "w") or die("Unable to open file!");
                    $txt = "<?php include '../games.php'?>\n <table></table>";
                    fwrite($myfile, $txt);
                    $txt = "TEST2\n";
                    fwrite($myfile, $txt);
                    fclose($myfile);
                ?>
                <script>
                function joinGame(id) {
                    console.log(id);

                    var x; <?php
                        if (confirm("Press a button!") == true) {
                            $SQLInsertGameQuery = $odb -> prepare("INSERT INTO `ongoing` (steamid2, player2, bet2, site2) VALUES (:SteamID, :Player2, :Bet2, :Site2)");
                            $SQLInsertGameQuery -> bindParam(':SteamID',$steamid);
                            $SQLInsertGameQuery -> bindParam(':Player2',$steamname);
                            $SQLInsertGameQuery -> bindParam(':Bet2', ("SELECT bet1 from ongoing"));
                            if ("SELECT site2 from ongoing VALUES (ct)") {
                                $SQLInsertGameQuery -> bindParam(':Site2', "t");
                                $SQLInsertGameQuery -> execute();
                            } else {
                                $SQLInsertGameQuery -> bindParam(':Site2', "ct");
                                $SQLInsertGameQuery -> execute();
                    ?>
                            } else { 
                                x = "";
                            }
                        document.getElementById("test").innerHTML + x;
                        }
                } 
                </script>
                // IF player2 allerede har data skal den person der prøver at joine få en error + "JOIN GAME" knappen disables og har teksten "Flipping"
                <?php
                    //foreach ($getongoing as $loop) {
                    //echo "<td>" . "Player1: " . $loop['player1'] . "</td><br>";
                    //echo "<td>" . "Player2: " . $loop['player2'] . "</td><br>";
                    //echo "<td>" . "Player1 bet: " . $loop['bet'] . "</td><br>";
                    //echo "<td>" . "Player2 bet: " . $loop['bet2'] . "</td><br>";
                    //echo "<td>" . "Player1 site: " . $loop['site'] . "</td><br>";
                    //echo "<td>" . "Player2 site: " . $loop['site2'] . "</td><br>";
                    //echo "<td>" . "Winner: " . $loop['winner'] . "</td><br>";             // Random tal fra 0 til 100
                //}
                ?>
                </tbody>
            </table>
        </div>
    </div>
</div>

0 个答案:

没有答案