我有这个查询:
$this->db->select ( 'u.user_id as id, u.username, u.first_name as firstName, u.last_name as lastName,' . null . 'as client' );
$this->db->from ( 'users u' );
但是在执行相同的操作时,它会显示空列。
还有
$this->db->select ( 'u.user_id as id, u.username, u.first_name as firstName, u.last_name as lastName, null as client' );
在users表中将null作为列名称,并在未找到列时报告错误。
虽然直接执行到mysql时,查询会给出预期的输出
SELECT u.user_id as id, u.username, u.first_name as firstName, u.last_name as lastName, null as client FROM users u
答案 0 :(得分:1)
您需要在select()
$this->db->select ( 'u.user_id as id, u.username, u.first_name as firstName, u.last_name as lastName, NULL as client' ,FALSE );
$this->db->from ( 'users u' );
答案 1 :(得分:1)
试试这个:
$this->db->select ( 'u.user_id as id, u.username, u.first_name as firstName, u.last_name as lastName',false);
$this->db->from ( 'users u' );
false
告诉不要逃避查询。