1

我经营着一个失物招领的宠物网站,但在列出丢失的宠物时遇到了麻烦。

http://alphapets.co.nz/lost/lost.php

我不知道如何在描述中只显示少量单词,以便所有列表的大小相同并且文本不会溢出。

php如下:

// Retrieves data from MySQL 
$data2 = mysql_query("SELECT * FROM pets WHERE status LIKE '".
                     $thisPage."' ORDER BY `pets`.`ID` DESC")
  or die(mysql_error());  //Puts it into an array 

while($info2 = mysql_fetch_array( $data2 )) { 
  //Outputs the image and other data
  echo "<div id='wrapper4'>
<div id='pet_profile_image'>
<img src=http://alphapets.co.nz/lost/petimages/resized_$info2[date]$info2[photo]
     class='mainimage'>
</div>

<div id='pet_description'>
  <h2><a href='/download.php?ID=$info2[ID]'>$info2[name]</a> </h2><br />
  <b>Location:</b> $info2[town], $info2[city]  <br />
  <b>Description</b>: $info2[description] <br /><br />
  <a href='/download.php?ID=$info2[ID]'>Click here for more</a>
</div>
</div>"; 
}
4

1 回答 1

1

这可能会有所帮助;

http://www.daniweb.com/web-development/php/threads/131085/how-to-display-part-of-text-from-msql

于 2012-05-06T01:10:13.020 回答