Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

How to get sum value in mysql table column using Codeigniter

by
Category:codeigniter
codeigniter mysql
How to get sum value in mysql table column using Codeigniter

Codeigniter provides select_sum method to get sum value in mysql table column. Writes a “SELECT SUM(field)” portion for your query. As with select_max(), You can optionally include a second parameter to rename the resulting field.

Let’s create a select_sum method in codeigniter

$this->db->select_sum('amount');
$result = $this->db->get('tbl_product')->row();  
return $result->amount;

1 Comments

Dongala

19 Dec 2017

Thank you!…

Html code work in comment box


Related Post