Database in CodeIgniter 4

We will cover 2 topics given below:

  • – Database connection in CodeIgniter 4.
  • – Database Access in controller or View.

Database connection in CodeIgniter 4

Open app/Config/Database.php and set your database connection.

 

Database Access in controller and View

Controller:

 

View:

 

Complete code of controller with DB Connection and connection to model.

 

Leave a Reply

Your email address will not be published. Required fields are marked *