Problem with sum result - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Problem with sum result (/showthread.php?tid=77571) |
Problem with sum result - achim_311 - 09-18-2020 How's it going everyone!!! I want to perform a sum, multiple columns. I have this code, i don't know if is the correct way to do it: Model: PHP Code: public function getTotalOrders($customer_id){ Controller PHP Code: data = [ View PHP Code: <?= $totalorders; ?> The problem is that codeigniter (4) doesn't show me any errors, but the in the view doesn't show any result. I've tried another way like ->first(); ->find() ->findAll() and with those it showed me error. Also i tried to add like this PHP Code: $this->selectSum('SUM(total) + SUM(s_h) + SUM(ship_cost) AS 'total') But still the same error or result. I hope you can give me a hand with this! Thanks in advance! |