How to make calculations?


#1

Hai all…
I’m new in using cakephp.
please help me…

i want to take the “id” value in users as a variable.
And SUM “id” value with “x” as new variable.

How to take “id” value as variable and create “x” variable, then SUM both values?
thank’s,


#2

It is depend on your query. If it is CakePHP 3 you get a query object what is a collection and you can use collection method’s.


#3

$x = $this->Users->find(‘all’)->where([‘Users.id’ => ‘$user->id’])

I hope this help!