//---使用php codeigniter查询从数据库表字段中获取n个字符的字符串
//--查看页面
<?php foreach ($query as $row)
{
$content = $row->blogger_content;
?>
<p> <?php echo $content; ?>
(here i want to list the content but only needed first 25 character) </p>
<?php } ?>
// what query want to use here..?
最佳答案
在您的模型类中尝试此操作。
$this->db->select(SUBSTRING(columnName, 0, 25))
->from(tablename)
->get();
关于php - 使用 php codeigniter 查询从数据库表字段中获取 n 个字符的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29937851/