从数据库中显示的最大字数

时间:2012-05-06 00:35:43

标签: mysql database max words

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

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>"; 
}

1 个答案:

答案 0 :(得分:1)