【发布时间】:2014-07-04 17:04:32
【问题描述】:
我已经完成了 Burak(此处链接:Limiting number of characters displayed in table cell)所说的,并且效果很好。除了...我的顶部条目没有显示数据,我不知道为什么..
这是我的代码的 sn-p:
<form id="mainform" action="">
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
<tr>
<th class="table-header-repeat line-left minwidth-1"><a href="">Title</a> </th>
<th class="table-header-repeat line-left minwidth-1"><a href="">Content</a></th>
<th class="table-header-repeat line-left" width="100px"><a href="">Date Posted</a></th>
<th class="table-header-options line-left"><a href="">Options</a></th>
</tr>
<tr>
<?php
$result = mysqli_query($con,"SELECT * FROM content ORDER BY news_date ASC");
while($row = mysqli_fetch_array($result))
{
echo '<tr>';
echo '<td>' . $row['news_title'] . '</td>';
echo '<td style="max-height: 10px;">' . $str . '</td>';
echo '<td width="100px">' . $row['news_date'] . '</td>';
echo '<td class="options-width">';
echo '<a href="includes/edit_content.php?=' . $row['news_id'] . '" id="Edit" class="icon-1 info-tooltip"></a>';
echo '<a href="includes/delete_content.php?news_id=' . $row['news_id'] . '" name="delete" id="delete" class="icon-2 info-tooltip"></a></td>';
echo '</tr>';
if (strlen($row['news_body']) > 100) $str = substr($row['news_body'], 0, 100) . "...";
}
?>
<br />
<br />
</form>
【问题讨论】:
-
你有一个未闭合的
上面的 php 标签。 刚刚修复它,谢谢.. 我仍然遇到顶行没有显示“news_body”但标题、日期、选项仍然显示所有行的问题
标签: php sql html-table strlen