【发布时间】:2018-06-30 18:02:55
【问题描述】:
我有一个使用 PHP 填充的 html 表:
<table class="flat-table flat-table-1" width="100%">
<tr style="background-color:#FFF;">
<td class="table-head">Name</td>
<td class="table-head">Review</td>
<td class="table-head">Rating</td>
</tr>
<?php
//run a query to find all the fields in the review table that belong to the specific hall, using the id in the url ($current_id)
if ($r = $db->prepare("SELECT * FROM reviews WHERE hall_id = :current_id")) {
//bind the parameters used in the above query using the 'current_id' variable
$r->bindParam(':current_id', $current_id);
//Execute the prepared query
$r->execute();
//search review table for all fields and save them in $review
$reviewtemp = $r->fetchAll();
foreach( $reviewtemp as $review) {
//loop and output the reviews
?>
<tr>
<td><? echo $review['name'];?></td>
<td><? echo $review['review']; ?></td>
<td><? echo $review['overall']; }}?></td>
</tr>
</table>
- <td><? echo $review['review']; ?></td>' - 包含需要使用显示更多/更少按钮缩短的长文本段,如果文本段超过 400 个字符。
我尝试使用在互联网上找到的代码片段,但没有成功。我希望也许这里有人可以指出我正确的方向?我很乐意使用我能使用的任何解决方案。
以下代码是我需要使用的那种东西,但是我不确定如何在我的代码中实现它:http://jsfiddle.net/Wpn94/326/
(--我之前也问过类似的问题,但没有回复。我现在已经更改问题并再次发布--)
【问题讨论】:
标签: javascript php jquery html-table