Zendframework 3 – Working with Database

We will see how to conntect to database and run select,insert,update,delete (CRUD)coomand in Zendframework 3.

First you have to install the zend_db component to work with databse. You can run the following composer command in the terminal

Next you can create an adapter for the databse by passing required config paraments

Once you get the adapter, you can run followng code

Possible Errors

Connect Error: SQLSTATE[HY000] [2002] No such file or directory
To solve above errots I changed local host to 127.0.0.1 in following code