Get data from table and show in view

I need help, I don’t why this is not working…

I created function in my pageController
public function listusers(){
$query = $this->Users->find(‘all’);
$results = $query->toArray();

And a view in template/pages/listusers.ctp
in there I wrote

<?= debug($users); ?>

but, I recieve this error:

[ Notice (8)](javascript:void(0);): Undefined variable: users [ APP/Template/Pages/listusers.ctp , line 1 ]

/src/Template/Pages/listusers.ctp (line 1 )


(table users has some users in there )

I use cakePhp in 3.5 version

move your debug to controller debug($results); and see what happens. Also you don’t need to echo debug() <?php debug() ?> will work.
And you can debug($this) , lot of stuff but you can search there for users.