加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

仅在php,mysql 中显示前50个字符

发布时间:2020-12-11 23:52:01 所属栏目:MySql教程 来源:网络整理
导读:参见英文答案 How do you pull first 100 characters of a string in PHP????????????????????????????????????6个 我在数据库表,标题和描述中有两个字段.我在循环中显示php中的数据. 我的代码: $sql = "select * from sightseeing"; $i = 1; $res = mysql_

参见英文答案 > How do you pull first 100 characters of a string in PHP????????????????????????????????????6个
我在数据库表,标题和描述中有两个字段.我在循环中显示php中的数据.

我的代码:

$sql = "select * from sightseeing";
    $i = 1;
    $res = mysql_query($sql,$conn); 
    if( mysql_num_rows($res) > 0) {
        while($row = mysql_fetch_array($res))
       {

        echo "

我想只显示描述字段中的前50个字符.怎么做? 最佳答案 试试这个

 $sql = "select * from sightseeing";
$i = 1;
$res = mysql_query($sql,$conn); 
if( mysql_num_rows($res) > 0) {
    while($row = mysql_fetch_array($res))
{

echo "

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读