CakePHP View a Record - CakePHP

How to View a Record in CakePHP?

To view data of database, we first need to get maintain of a table the usage of the TableRegistry elegance. we can fetch the instance out of registry using get() approach. The get() technique will take the name of the database table as argument. Now, this new example is used to discover statistics from database using locate() approach. This method will go back all data from the requested table.


Make modifications within the config/routes.php report as shown inside the following code.


Create a UsersController.php file at src/Controller/UsersController.php. replica the subsequent code in the controller document.


Create a directory customers at src/Template, ignore if already created, and below that directory create a View file referred to as index.ctp. replica the following code in that document.


Execute the above instance by touring the subsequent URL



Upon execution, the above URL will give you the subsequent output.

view a rec

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

CakePHP Topics