Medium Cross Post – CodeIgniter 4 CRUD: Delete

When the time comes that you no longer have a need for specific data, use DELETE to remove it completely from your table. CodeIgniter 4 Models have a delete() method that is super-easy to use. Continue reading for more information…


If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

CodeIgniter 4 CRUD Series with MySQL

I have written a now complete 4-part series over on my Medium account about CodeIgniter 4 Model CRUD operations. Feel free and visit any of the previous posts in the series to get up to speed:

In the post, CodeIgniter 4 CRUD Series with MySQL: Delete, I cover the Model delete() method used to remove a specific row of data from the table.

Are you a Medium member? If so, receive an email notification each time I publish a blog post if you prefer the Medium platform. Not a member? No worries! Use my sign-up link (I will get a commission at no extra cost to you) and join. I really enjoy reading all the great content there and I know you will too!!!

Model delete() method and leveraging existing functionality

For better or worse, the delete() method simplifies removing rows from the database. In order to restrict the number of rows deleted, provide a parameter that is the primary key of the row to remove.

Using the CodeIgniter 4 Model CRUD methods saves time for those common operations across the application. I advocate saving time where you can in code. There will be a time that some pre-built functionality won’t exactly fit your needs and coding from scratch is the only option.

So leverage built-in functionality while you can! Thanks for reading!

The Newsletter for PHP and MySQL Developers

Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.

Consider making a donation as I continue to provide valuable content here on my blog. Thank you so much!!! Every bit is much appreciated and helps tremendously!

If you found value in this post, you can show your appreciation and buy me a coffee. It is my favorite drink!

Hey thanks for commenting! Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.