drpjdfj618393 2014-07-29 20:33
浏览 16
已采纳

无法在页脚上方打印PHP内容

Just a quick question. Everything is printing out fine on this page, except the PHP content is printing at the bottom of the page underneath the footer and everything. I want it to be above the footer.

In the code it's positioned to be as such, but it still prints underneath anyway. Is there something I'm missing when it comes to certain objects being printed out?

Here's the section is question (anything marked with a ~ is just hidden information):

<section>

<?php
//Retrieving Database
mysql_connect("~", "~", "~") or die(mysql_error()); 
mysql_select_db("~") or die(mysql_error()); 
$data = mysql_query("SELECT * FROM teams ORDER BY game ASC") or die(mysql_error());
    echo '<table>
    <tr><th>TEAM NAME</th><th>GAME</th><th>PLATFORM</th><th>PLAY STYLE</th><th>TIMEZONE</th><th>FOUNDER</th></tr>';
    while ($myrow = mysql_fetch_array( $data )) {
        echo "<tr>
                <td>".$myrow['team']."</td>
                <td>".$myrow['game']."</td>
                <td>".$myrow['platform']."</td>
                <td>".$myrow['play']."</td>
                <td>".$myrow['timezone']."</td>
                <td>".$myrow['player']."</td>
              </tr>
";
    }
?>

    <!-- Line Break Design -->
    <hr style="border: 3px outset #595955;" width="100%" size="5">

</section>

<!-- Footer (name, email, etc.) -->
<footer id="footer">
    <img src="images/logo.png" width="80" height="65" alt="Our Logo" class="floatLeft"/>
    <p>Contact Us<br/><a href="~" target="_blank">~</a><br/><a href="~">~</a></p><br/>
</footer>
  • 写回答

1条回答 默认 最新

  • dongtuo5611 2014-07-29 20:39
    关注

    Well, here's a problem, you never close your <table> after finishing with the looped echo of content.

    Add this after your while loop:

    echo "</table>";
    

    And it should work nicely. You can see the same thing happening in this JSFiddle, where a closing </table> is omitted. (Note the location of the "Hi".)

    Hope this helps! Let me know if you have any questions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序