How ORDER BY is restricted in GROUP BY queries

As always, I am sharing what I learn here on my blog. As I continue to study SQL, the language never ceases to amaze me with those little intricacies you don’t necessarily learn of unless you are bitten by them, or through intentional study. Luckily, my case is the latter of the 2. I’m referring to the ORDER BY clause when used in GROUP BY queries. Continue reading for more information.

(more…)

WordPress Contact Form 7: Blog post compilation

Anyone with a website surely needs a reliable contact form to allow visitors and guests to reach out to them. If you are using WordPress, there are more options for contact form plugins than I could fill up in words here in this post. However, one of the more popular and easy-to-configure plugins is Contact Form 7. I recently wrote a couple of blog posts over on Medium detailing how to create a simple contact form using the Contact Form 7 plugin and want to share those posts here on my blog for readers who may be interested…

(more…)

Use MySQL BLOB column with PHP to store .pdf file

Like always I am sharing new things I learn here on my blog. I was recently working on a requirement for a LAMP stack web application reporting dashboard in which I needed to store – and eventually – retrieve a .pdf file. I have read in several places (this fantastic book is a great resource) that a viable option is storing images or documents (.pdf in this case) in the actual database table as opposed to on the server file system. MySQL has the BLOB datatype that can be used to store files such as .pdf, .jpg, .txt, and the like. In this blog post, I cover how I accomplished uploading and storing the actual .pdf file in a BLOB column in MySQL using PHP. Any corrections, tips, pointers, and recommendations for best practices are always welcome. We all learn as we go!!!

[Keep reading for more SQL database and PHP/Python-centric content >>>]

Beginning Perspective on PHP Arrays

Arrays are one of the most important PHP data types. An array is composed of 1 or more key/value pairs and can store any type (E.g., strings, integers, decimal numbers, etc…). Array values (or elements) are accessed via a key (index), which is either numerical-based or a string-based. Arrays composed of string-based indexes are known as associative arrays. Keep reading for an introductory-level coverage of PHP arrays, as I understand them…

[Keep reading for more MySQL database and Python/PHP-centric content >>>]

MySQL Shell Python mode for multiple ALTER TABLE statements – easily

There may come a time you need to rename one or more columns in an existing MySQL table for a variety of reasons. Using ALTER TABLE, to rename a column is an easy enough command. But, suppose there are multiple tables in the same database/schema that have the same-named column and all of those columns need to be renamed. That could be a lot of ALTER TABLE statements to type out. Save your energy and time, avoiding all of those ALTER TABLE commands all-together. If you are lucky enough to be working with a MySQL version > 8.0 then the Shell is your salvation. With just a few lines of Python code in \py mode, all of your trouble(s) and headache(s) are no more…

[Keep reading for more MySQL database and Python/PHP-centric content >>>]