duanlinjian5819 2013-02-12 23:46
浏览 109

MySQL数据未完全显示在html表中。 数据被切断,一半的字段不是满的

Here's the Code.

$result = mysql_query("SELECT * FROM situations");

echo "<table border='1'>
<tr>
<th>Case#</th>
<th>Cop(s)</th>
<th>Code</th>
<th>Vehicle/Person</th>
<th>Location</th>
<th>Division(s)</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
echo "<form action=situations.php method=post>";
echo "<tr>";
echo "<td>" . $row['Case#'] . " </td>";
echo "<td>" . "<input type=text name=cop value=" . $row['Cops']. " </td>";
echo "<td>" . "<input type=text name=sector value=". $row['Code'] . " </td>";
echo "<td>" . "<input type=text name=vehicle value=" . $row['Vehicle'] ." </td>";
echo "<td>" . "<input type=text name=location value="  .$row['Location'].  " </td>";
echo "<td>" . "<input type=text name=division value=" .$row['Division'].  " </td>";
echo "<td>" . "<input type=hidden name=hidden value=" .$row['Case #'] . " </td>";
echo "<td>" . "<input type=submit name=update_situations value=Update" . " </td>";
echo "</tr>";
echo "</form>";
  }
echo "</table>";

I have it so I can update it but my data is not fully shown. EX: I would have "Dukes Blvd" in Location and it would only show "Dukes" Please Help! and I am newb to PHP, MySQL.

  • 写回答

2条回答 默认 最新

  • dqwh1119 2013-02-12 23:48
    关注

    You're missing quotes;

    while($row = mysql_fetch_array($result))
    {
    ?>
    <form action="situations.php" method="post">
    <tr>
    <td><?php echo $row['Case#']; ?></td>
    <td><input type="text" name="cop" value="<?php echo htmlentities($row['Cops'], ENT_QUOTES, 'UTF-8') ; ?>"></td>
    <td><input type="text" name="sector" value="<?php echo htmlentities($row['Code'], ENT_QUOTES, 'UTF-8'); ?>"></td>
    <td><input type="text" name="vehicle" value="<?php echo htmlentities($row['Vehicle'], ENT_QUOTES, 'UTF-8'); ?>"></td>
    <td><input type="text" name="location" value="<?php echo htmlentities($row['Location'], ENT_QUOTES, 'UTF-8'); ?>"></td>
    <td><input type="text" name="division" value="<?php echo htmlentities($row['Division'], ENT_QUOTES, 'UTF-8'); ?>"></td>
    <td><input type="hidden" name="hidden" value="<?php echo htmlentities($row['Case #'], ENT_QUOTES, 'UTF-8'); ?>"></td>
    <td><input type="submit" name="update_situations" value="Update"></td>
    </tr>
    </form>
    <?php
    }
    ?>
    </table>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥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 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看