OpenLampTech issue #26
PHP Laravel try/catch; WordPress block patterns; mysqldump backups; PHP redirection; Thank you for reading the newsletter for PHP/MySQL developers!
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:
Receive a free copy of my eBook, “10 MySQL Tips For Everyone” when you subscribe to the weekly OpenLampTech newsletter!
Recently Published on the Digital Owl’s Prose Blog
This week on the Digital Owl’s Prose developer blog, I published the article, Multiple WHERE Clause Conditionals Using the MySQL AND Operator.
WHERE clause filters with the
AND operator requires that each individual conditional return
TRUE for a row to be included in the results. Learn how to use the
AND logical operator in the
WHERE clause with examples in this guide.
I published a thread here on the OpenLampTech publication page. Check it out and chime in if you would like.
I have curated some fantastic reads for you this week. Let’s get to them!
This Week’s Picks
✔️ How to Backup and Restore a MySQL Database
By: Mohammed Noufal
The obvious reason to run backups on your MySQL database is to have a copy in case of corruption or data loss.
However, 2 other reasons are noted in this article:
Prior to a version upgrade.
Migration or cloning from one server to another.
Two different methods are covered, both with examples and clear explanations:
phpMyAdmin web GUI
Learn the syntax and breakdown of the
mysqldump command-line utility for making and restoring a backup of your MySQL installation.
One downside of
mysqldump is mentioned:
"It is impossible to backup MySQL databases or data to separate .sql files with the mysqldump utility."
phpMyAdmin provides more of a visual experience in taking backups and restoring them with the web interface.
mysqldump, command-line arguments or options are used, but in phpMyAdmin, mostly checkboxes and/or radio buttons help create the specific type of backup (E.g., data only) you want.
Both phpMyAdmin and
mysqldump are great options for backing up the MySQL database.
✔️ How to redirect to another page with PHP
By: Alex Web Develop
I've always used the
header() function in whatever Controller I'm in to redirect to another URL.
There are several pointers and tips in this article about redirecting in PHP.
A few optional practices that stood out to me are:
die()function after the
Store any output in a variable. (optional)
Use output buffering with the
header() function is but one way you can redirect to another URL and 2 other methods are also discussed:
Redirect with an HTML meta tag
✔️ Beginner’s Guide: How to Use WordPress Block Patterns
With the advent of full site editing (FSE), block building is now a mainstay and integral part of WordPress.
If I stop and think about it, I've been using blocks in my blog posts over on the Digital Owl's Prose developer blog since Gutenberg came out.
Now I just need to learn to apply them site-wide when page building and designing layouts.
This is where block patterns come in to save the day.
This post from the WPBeginner blog is a solid resource that you (and I) can learn how to use block patterns from.
✔️ Better way of using TryCatch in PHP | Laravel
This post has a PHP code snippet of a
catch() block with suggestions for useful data metrics such as:
Nice handy reference.
✔️ How MySQL(InnoDB) follows ACID Properties?
By: Unknown at time of publishing
See a high-level overview of the 4 properties of ACID:
Atomicity - Within a transaction, nothing is partial. It is either done or not.
Consistency - Any changes to data are preserved.
Isolation - No transactions should affect or interfere with another transaction.
Durability - A completed transaction should have the data written to the database and stored.
This post further explores how MySQL InnoDB achieves these ACID properties with a dedicated section for each.
✔️ FIND NUMBER OF DAYS IN THE MONTH – MYSQL
By: SHAFI SHAIK
If you work with data in any shape, form, or fashion then dates always play some significant role in said data.
MySQL provides many built-in date and time functions.
If you need a quick one-off query to find out how many days are in a particular month, you can use these 2 date functions together:
Learn how with the example queries in this short article.
✔️ MySQL Find All Calendar Dates in the Month (video short)
By: Joshua Otwell
Check it out and let me know what you think. I'm less experienced (at the time of writing) at recording videos so hopefully, I get better with time.
How Can I Help You
📰 Get your brand, product, or service the attention it needs with affordable classified ad placement in the OpenLampTech newsletter.
Discover premium MySQL learning material over in my Kofi Shop today!
I’ve recently begun another email newsletter I’ve named, The Techpreneur Developer Newsletter. This newsletter is where I am writing and building in public about my goals, trials, and ambitions to become successful as a full-time creator and developer with my technical writing, SQL, and PHP skills. The first issue, What is a Techpreneur?, is available for reading.
Sign-ups are much appreciated.
Thank you for reading. I hope you have a great rest of your week.
Want to support this newsletter and my work? Drop some spare change in my Tip Jar.💰
Disclosure: Some of the services and product 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.