尝试使用其他页面中的特定数据创建单独的html页面

I am currently in the process of creating a baseball-themed website backed by a database. I have a Scores page that displays a league scoreboard for a chosen date by the user: Screenshot of Scores page

I am using retrosheet game logs stored in a sqlite database to make this happen with the following code:

$sql = "SELECT *, v.teamName AS 'Visitor', h.teamName AS 'Home' "
            . "FROM Games2 "
            . "INNER JOIN TeamNames AS v "
            . "ON Games2.vTeam = v.teamID "
            . "INNER JOIN TeamNames AS h "
            . "ON Games2.homeTeam = h.teamID "
            . "WHERE date = $date";
    $result = $conn->query($sql);

    while ($row = $result->fetch(SQLITE3_ASSOC)):
    ?>
    <div class="content">
        <table class="left">
            <tr>
                <th> </th>
                <th>R</th>
                <th>H</th>
                <th>E</th>
                <th rowspan="3"><a href="./BoxScore.php"><input id="box" type="button" value="Box Score"></a></th>
            </tr>
            <tr>
                <td><?php echo $row['Visitor']; ?></td>
                <td><?php echo $row['visitScore']; ?></td>
                <td><?php echo $row['vH']; ?></td>
                <td><?php echo $row['vE']; ?></td>

            </tr>
            <tr>
                <td><?php echo $row['Home']; ?></td>
                <td><?php echo $row['homeScore']; ?></td>
                <td><?php echo $row['hH']; ?></td>
                <td><?php echo $row['hE']; ?></td>
            </tr>

        </table>   
    </div>

Now, where my issue is coming in. I'm trying to have it so when my "Box Score" button is clicked it redirects the user to a unique Box Score page built with the queried data on my Scores page. Could anyone provide some assistance about how I could/should go about doing this?

I was thinking I could store the date and teams in PHP variables and then be able to query again on the new page using those variables to access that specific game possibly?

duai8153
duai8153 在链接./BoxScore.php将行id附加为GET参数,然后在该页面上再次为该ID执行查询。
大约 2 年之前 回复
dongxing8009
dongxing8009 将所需数据作为POST数据发送到下一页。在旁注。SqlLite主要用作本地数据库,例如应用程序。在我看来,对网站来说并不是很好。
大约 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问