Skip to content
Advertisement

How to get the SUM of 3 individual columns in codeigniter

I am trying to get the SUM of 3 individual columns. When I try to output I get nothing. What do I do wrong?

Model

Controller

View

Advertisement

Answer

$this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names. This is useful if you need a compound select statement where automatic escaping of fields may break them. (Reference)

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement