Discover more from OpenLampTech
OpenLamp.tech issue #5
SQL Optimization Tips; CodeIgniter 4 LastInsertID(); WordPress "too many redirects"; PHP's isset()
Hey glad to have you here! 👍
If someone shared this newsletter with you and you are not yet subscribed, please use the Subscribe button below and join:
Last month’s featured piece was:
This month is shaping up to be, MySQL Database Metadata with CodeIgniter 4 Query Builder so be sure and subscribe to OpenLamp.tech so these featured issues drop directly in your inbox!
I have curated some fantastic reads for you this week. Let’s get to them!
This Week’s Picks
✔️ A Look At PHP’s isset()
#php
PHP’s isset()
is one of those parts of PHP I use all the time without really too much thought other than what I'm trying to accomplish with isset()
. I honestly was unaware that isset()
is not a function, but is instead a language construct.
Also, I am surprised - but pleased to learn - that you can pass multiple parameters to a single isset()
versus chaining them one after the other.
Instead of doing this:
if(isset($var) && isset($var1)) {
//some code
}
You can do this:
if(isset($var, $var1)) {
//code here
}
Plenty more to learn about isset()
in this article.
✔️ Summarize 52 SQL statement performance optimization strategies, you’d better save to favorites
#mysql #sql
Wow.
This is one massive list of 52 SQL optimization strategies. As is suggested in the title, I am definitely bookmarking this one. Without a doubt, optimization is one of the (many) areas I have to work on and this reference is a good place to start.
Some key takeaways I noted:
Establish indexes on columns used in the
WHERE
andORDER BY
clauses.Use
BETWEEN
where you can instead ofIN()
for range-based queries with consecutive values.Make use of Temporary Tables when you can.
✔️ Install WordPress CMS on Oracle Linux with MySQL database
#wordpress #mysql
Detailed walkthrough from the official documentation on how to set up WordPress on Oracle Linux. I haven't done this myself (yet) but it is interesting in that I believe you can use MySQL 8 in this case (Readers please let me know if this is incorrect). Which has more advanced features than MySQL 5.7 or the comparable MariaDB version that WordPress typically runs.
✔️ Using Database Transactions in Laravel
#laravel #mysql
This post covers a good use case for transactions; uploading multiple CSV's to the MySQL database.
What if the uploads fail halfway through the import? This is one of those places transactions shine in my opinion. I personally just like the assurance that if something goes wrong, we can revert any changes with a rollback. Gives me peace of mind that the data is sound no matter what (in a sense at least).
✔️ How one can Repair “Too Many Redirects” WordPress Error
#wordpress
This summary post covers an informative overview of what the "too many redirects" error is and why it happens.
13 different solutions are covered to try and correct the issue of "too many redirects" with some of the more basic fixes such as:
Clearing browser cache
Force a page refresh
Clearing site cookies
✔️ How to Retrieve MySQL Last Insert ID in CodeIgniter 4
#mysql #codeigniter4
It seems like more often than not when developing applications and there are multiple tables involved, you need the Last Insert ID value from a successful INSERT
.
MySQL has an AUTO_INCREMENT column attribute you can place on a table column and have an auto-incrementing numerical counter of sorts. I wanted to learn how to capture this value in application code using CodeIgniter 4.
Like always, I enjoy sharing what I learn as I learn a new concept, hence I wrote this post where I cover 2 built-in CodeIgniter 4 methods you can use. I hope the post helps you out if you are searching for this sort of information in your own development workflow.
➡️ Read this post on Digital Owl's Prose…
✔️ Ask the Bartender: Should I Use a Page Builder or Wait for Block Themes?
#wordpress
The WordPress landscape is constantly changing no doubt. Especially in the theme, Gutenberg, and page builder areas. I'm currently (at the time of writing) redesigning my site, Digital Owl's Prose, and decided to use Elementor and Astra (free versions) to get everything up and running quickly, with minimal fuss.
I personally like Gutenberg and enjoy using the block editor to write my blog posts.
⭐⭐⭐ Many of the posts I curate and share in this newsletter, I read and enjoyed on Medium. If you are not yet and member and wish to join the platform, I would be more than grateful if you would use my sign-up link. At no extra cost to you, I will receive a small portion of your membership fee when you sign up. Thank you! 🙏
Extra stuff…
Great read here: The Dependency Injection Paradigm
Newsletter shoutout 📣: Opt In Weekly is awesome! I read my 1st issue recently and really enjoyed it. You definitely need to check it out.
Newsletter opinion piece from WPBeginner: Substack vs WordPress: Which One is Better? (Pros and Cons)
Did you enjoy this issue of OpenLamp.tech? Please share it with others so that they can enjoy the content as well. Thank you!!!
“Reply” or comment and let me know what you think of this issue of OpenLamp.tech.
What do you want to see more of?!?
What do you want to see less of?!?
I’d love to know!
Also, share with me links to your published blogs and articles so that I can read them and possibly include them here in the newsletter!
Thank you for reading. I hope you have a great rest of your week.
Take care.
Joshua Otwell
Visit my blog Digital Owl’s Prose, where I write regularly on CodeIgniter, PHP, and SQL. I’m also active on Medium, LinkedIn, Twitter, and Instagram.
How can I help you?
Are you thinking of starting up a blog? I use WordPress for my blog, Digital Owl’s Prose. Let’s both save money on the plans offered. 💸
Grab a Gmail HTML Email Signature template from my Etsy shop and make your emails pop and stand out. ✉️
Need hosting for your next web application or WordPress site? I use and highly recommend Hostinger. They have great pricing and service.
I enjoy reading Refind: The essence of the web, every morning in your inbox. Subscribe for free. Help me get a premium subscription by signing up yourself with my referral link.
Want to support this newsletter and my work? Drop some spare change in my Tip Jar.💰
Disclosure: Some of the services and products links in this email are affiliate links. At no additional cost to you, should you make a purchase by clicking through one of them, I will receive a commission.
Cover photo credits: Image by Gerd Altmann from Pixabay