![]() |
How do I get the total amount from a column? - 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: How do I get the total amount from a column? (/showthread.php?tid=81172) |
How do I get the total amount from a column? - castle - 01-31-2022 Hi, I'm upgrading my CI3 model to CI4, but things are not working well. CI 3 PHP Code: // Sales CI 4 PHP Code: public function total_weekly_sales() Code: Object of class CodeIgniter\Database\MySQLi\Result could not be converted to string. RE: How do I get the total amount from a column? - iRedds - 01-31-2022 The get() method returns an instance of the Result class. Generating Query Results RE: How do I get the total amount from a column? - castle - 01-31-2022 Sorry, I still don't get it. RE: How do I get the total amount from a column? - Chroma - 01-31-2022 You are getting an object of Type Result, is what @iRedds is saying. That implies you will not be able to convert it to a string like that, because it is a class or a complex set of fields. RE: How do I get the total amount from a column? - ikesela - 01-31-2022 (01-31-2022, 05:28 AM)castle Wrote: Hi, Code: ->get()->getResult() // return array of object |