There is a large OOP file "MysqliDb.php".

Tell me, what kind of function in it is responsible for the summation of data in a particular column, from sorted rows? From phpmyAdmin. I looked through everything, I could not understand which of them.

Example: you need to summarize all the values ​​in the 'price' column in the 'models' table. At the same time there was a sorting of models, where the parameter 'model_id' == $ model_id;

$db->where('model_id', $model_id); $summa = $db->getValue('models','price'); 

I thought this was a 'getValue' function, but it took only ONE last value!

  • taken from joshcam .... his profile says josh.lee.campbell@gmail.com - write and ask ....... also have comments and issues on the githaba ....... write and ask .. .... because the author certainly knows for sure exactly than the passers-by in the form of resource dwellers - Alexey Shimansky
  • @ Alexey Shimansky Clear! I thought it was a popular OOP file and many people use it, but apparently I was wrong! OK! - Aibek Sydygaliev

1 answer 1

Correct answer:

 $db->where('model_id', $model_id); $summa = $db->getValue('models', 'sum(price)'); echo 'total price: ' . $summa;