Welcome Guest, Not a member yet? Register   Sign In
Round brackets issue in Codeigniter
#3

The issue you are facing is because the Codeigniter query builder is adding round brackets around the table name by default. To prevent this, you can set the "_protect_identifiers" property to false before running the query. Additionally, you can pass "false" as the second parameter to the "from()" method to prevent the table name from being enclosed in brackets. The modified query would look like this:

$this->db->_protect_identifiers = false;
$this->db->select('*')->from('tb_card', false);
$this->db->where('company_id', $this->company_id, FALSE)->get()->row_array();

This should generate the correct query for MySQL and SQL Server.
Reply


Messages In This Thread
Round brackets issue in Codeigniter - by kalyanbl - 03-10-2018, 03:40 AM
RE: Round brackets issue in Codeigniter - by jamesmillere - 01-19-2023, 12:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB