下表打印出完整的评论(($rowquote["comment"])).我怎么能把它限制在250个字符?
提前致谢,
约翰
echo "<table class=\"samplesrec1quote\">";
while ($rowquote = mysql_fetch_array($resultquote)) {
echo '<tr>';
echo '<td class="sitename1quote">"'.stripslashes($rowquote["comment"]).'"</td>';
echo '</tr>';
}
echo "</table>";
Run Code Online (Sandbox Code Playgroud)
编辑: 我left(comment, 250)在查询中使用它.因此,我认为 jensgram应该得到他对以下其他人答案的评论.
或者你可以在MySQL端完成并节省一点带宽.
select substring(comment, 0, 250) as comment
Run Code Online (Sandbox Code Playgroud)
代替
select comment
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1090 次 |
| 最近记录: |