Medium Cross-post – CodeIgniter 4 CRUD: Update

In some applications, data may never change. Yet, in others, data changes numerous times in its lifecycle. In SQL the UPDATE command changes existing rows of data. CodeIgniter 4 Models have 2 methods available for update operations: update() and save(). Continue reading and learn more about update()


Self-Promotion:

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

This post is a re-share of an article I originally published on my Medium account and is part 3 in the CodeIgniter 4 CRUD with MySQL series. Be sure and visit the 2 previous blog posts to get up to speed.

  1. CodeIgniter 4 CRUD Series with MySQL: Create
  2. CodeIgniter 4 CRUD Series with MySQL: Read

CodeIgniter 4, like most frameworks, provides an ORM (or something comparable) to help ease the pain of working with databases (if that is in fact, pain for you 😁). In CodeIgniter’s case, there are the Model and Query Builder classes

CodeIgniter 4 Model update() method

The CodeIgniter Model class has CRUD methods built right in and they are super-easy to employ for those standard CRUD operations. The model update() method accepts 2 parameters for UPDATE operations: the primary key id for the target row to be updated, and an associative array of data with key/value pairs matching the tables’ columns.

Learn more about the update() method and see examples in the post, CodeIgniter 4 CRUD Series with MySQL: Update.


I write a weekly email about SQL/PHP that I’m studying and interested in. If that sounds like something you would like to be a part of, learn more about it here. Thank you!


Further Reading

Feel free to visit any of the below posts for similar content:

As always, if you have any questions or see any mistakes in the code, please let me know via the comments. Constructive comments help me provide accurate blog posts and are much appreciated.

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!

Like what you have read? See anything incorrect? Please comment below and thank you for reading!!!

A Call To Action!

Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.

Visit the Portfolio-Projects page to see blog posts/technical writing I have completed for clients.



To receive email notifications (Never Spam) from this blog (“Digital Owl’s Prose”) for the latest blog posts as they are published, please subscribe (of your own volition) by clicking the ‘Click To Subscribe!’ button in the sidebar on the homepage! (Feel free at any time to review the Digital Owl’s Prose Privacy Policy Page for any questions you may have about: email updates, opt-in, opt-out, contact forms, etc…)

Be sure and visit the “Best Of” page for a collection of my best blog posts.


Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.

Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, are performed on a personal development/learning workstation environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.

Hey thanks for commenting! Leave a Reply

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