Site icon Cody Paste

CRUD Query in CodeIgniter 4

You can find Database Query for CRUD operation in  CodeIgniter 4 below.

 

SELECT

For Number of rows you can use ‘$result->get()->getNumRows();‘ butit will return 1 record more because of ‘$result->get()->getResult();
You can use only one of them ‘$result->get()->getNumRows();‘ OR ‘$result->get()->getResult();‘ for better result.

So, it’s preferred to use ‘count($record);‘ for number of rows.

 

INSERT

 

UPDATE

 

DELETE

 

 

Exit mobile version