php codeigniter中的concat空间不工作

mo49yndu  于 2022-12-07  发布在  PHP
关注(0)|答案(3)|浏览(134)

我的选择查询总是提示一个错误,即使我已经在它的结尾放置了FALSE。

function preparedBy($series){
    $this->db->select('CONCAT (users.FirstName,' ',users.MiddleName,' ',users.LastName) as name',FALSE);
    $this->db->from ( 'users' );
    $this->db->join ( 'entry ', 'entry.ClericalAide = users.UserName');
    $this->db->where ( 'entry.Series', $series);
    $query = $this->db->get();
    return $query->row_array();
}

这是我在我的sql select

中悬停时的错误

vddsk6oq

vddsk6oq1#

你的报价全乱了。试着运行这个:

function preparedBy($series){
    $this->db->select('CONCAT (users.FirstName, users.MiddleName, users.LastName) as name',FALSE);
    $this->db->from ('users');
    $this->db->join ('entry','entry.ClericalAide = users.UserName');
    $this->db->where ('entry.Series', $series);
    $query = $this->db->get();
    return $query->row_array();
}
ulydmbyx

ulydmbyx2#

尝试将函数更改为

function preparedBy($series){
$this->db->select('CONCAT (users.FirstName,'". ."',users.MiddleName,'". ."',users.LastName) as name",FALSE);
$this->db->from ( 'users' );
$this->db->join ( 'entry ', 'entry.ClericalAide = users.UserName');
$this->db->where ( 'entry.Series', $series);
$query = $this->db->get();
return $query->row_array();
}
yks3o0rb

yks3o0rb3#

只要加上" ",而不是' '

function preparedBy($series){
    $this->db->select('CONCAT (users.FirstName," ",users.MiddleName," ",users.LastName) as name',FALSE);
    $this->db->from ( 'users' );
    $this->db->join ( 'entry ', 'entry.ClericalAide = users.UserName');
    $this->db->where ( 'entry.Series', $series);
    $query = $this->db->get();
    return $query->row_array();
}

相关问题