0

I am trying to get an integer value of the amount field in my views tables. I am able to find the value but not return it as an int

$amount = $views
            ->find()
            ->select('amount')
            ->where(['date'=>$todaysdate])
            ->first();

        echo $amount;

this echos out { "amount": 2 }. How would i just get an int variable with the 2?

user3704648
  • 349
  • 3
  • 14
  • That's really just CakePHP 101, I don't think that it's of much use for future readers. **http://book.cakephp.org/3.0/en/orm/entities.html#accessing-entity-data** – ndm Jul 27 '16 at 20:12
  • Sorry, I tried a lot of stuff but nothing really worked. Thanks for the help! :) – user3704648 Jul 27 '16 at 20:18

1 Answers1

0

In your case, you should use: echo $amount->amount. You should spend some time reading the documentation.

Muntasir
  • 101
  • 10