在第一頁上,我想將$row['opis']
限制爲100個字符,但用戶可以輸入500個字符,因此我需要在第一頁中限制$row['opis']
。我怎樣才能做到這一點?減少從數據庫中顯示的文本
這是我的代碼:
<?php
mysql_connect("localhost","root","123") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$strSQL = "SELECT * FROM table_name ORDER BY id DESC";
$rs = mysql_query($strSQL);
while($row = mysql_fetch_array($rs)) {
echo '<div class="col-md-3 col-sm-6 masonry-grid-item">
<div class="listing-item">
<div class="overlay-container">
<img src="images/product-1.png" alt="">
<a href="oglas/index.php?id=' . $row['id'] . '" class="overlay small">
<i class="fa fa-plus"></i>
<span>View Details</span>
</a>
</div>
<div class="listing-item-body clearfix">
<h3 class="title"><a href="oglas/index.php?id=' . $row['id'] . '">'. $row['naziv'] .'</a></h3>
<p>' . $row['opis'] . '</p>
<span class="price">' . $row['tel'] . '</span>
<div class="elements-list pull-right">
<a href="#" class="wishlist" title="wishlist"><i class="fa fa-heart-o"></i></a>
<a href="oglas/index.php?id=' . $row['id'] . '">Pogledaj</a>
</div>
</div>
</div>
</div>';
}
mysql_close();
?>
謝謝!
我從 '$ OPIS' 100需要,編寫查詢? – Mile 2015-02-06 08:40:24
根據「GET」值(如果有100多個圖表,在頁面中添加一個「頁面」導航欄),在用戶點擊「查詢」按鈕時,在您的sql查詢(0,100,101,200,...)中使用「LIMIT」下一頁「,這應該觸發」YOURPAGE&p = 2「,例如...或使用POST ...你的問題對我來說並不是很清楚......,我想你想在頁面顯示中限制記錄號,但我是甚至不知道它^^,需要更多的信息/細節... – Julo0sS 2015-02-06 08:40:45
問題是,如何添加子字符串以顯示只有100個圖表,如果用戶插入500個圖表評論,如何在第一頁顯示只有100個3點? – Mile 2015-02-06 08:44:05