dongwen4630 2014-09-15 20:23
浏览 22
已采纳

PHP脚本生成一个不需要的奇怪的附加列[关闭]

I'm trying to solve this issue for about 5 hours now and I don't do any progress. :( I've got a PHP script which does a SQL query. In a while loop it should output table rows with a defined number of columns. I've reduced the script to a minimum without any variables. There are 6 defined columns within the while loop, but the script creates another (empty) one after the column vol, so I have 7 at the end.

I have no idea, what the problem could be. Did anyone of you anytime experience something similar? The code:

$sql_events = "SELECT * FROM events ORDER BY eventID ASC";
$allevents = mysqli_query($db, $sql_events);
while($row = mysqli_fetch_object($allevents)){
  echo "<tr>";
  echo "<td>ID</td>";
  echo "<td>date</td>";
  echo "<td>vol<td/>";
  echo "<td>5</td>";
  echo "<td>value</td>";
  echo "<td>actions</td>";
  echo "</tr>";
}

And the HTML result of this:

<tr>
  <td>ID</td>
  <td>date</td>
  <td>vol</td>
  <td></td>
  <td>5</td>
  <td>value</td>
  <td>actions</td>
</tr>

I do use the same script for another table in the same database and it is working properly. I have no idea what I could additionally check and every hint is much appreciated!

  • 写回答

3条回答 默认 最新

  • dpy83214 2014-09-15 20:25
    关注

    You have a markup error in this line:

      echo "<td>vol<td/>";
    

    Change it to:

      echo "<td>vol</td>";
    

    The extra markup you see is generated by your browser to prevent the HTML error.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 经gamit解算的cors站数据再经globk网平差得到的坐标做形变分析
  • ¥15 GD32 SPI通信时我从机原样返回收到的数据怎么弄?
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错
  • ¥20 @microsoft/fetch-event-source 流式响应问题
  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!