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 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?