40 Articles by A Pritchard

MySQL Bitwise Operators: User Permissions Example

So here is another 'better late than never' discovery of mine: MySQL bitwise operators. For reasons of efficiency, it is far better to do something in a MySQL query than looping through the results and applying it using PHP and this is a great tip for that. I came across »

Using LIMIT in a MySQL Subquery: An Alternative

When attempting to pull some database data a short time ago, I assumed the solution to the particular problem would be to use LIMIT in a MySQL subquery. Admittedly, this was something I'd never had to do before so it surprised me a bit when MySQL gave me this error »

PHP Array Sort Functions: An Overview

When you need to sort an array alphabetically, numerically or by some other criteria, PHP most likely provides a function to help you. This is great but there are enough PHP array sort functions to warrant some confusion and at first it can be difficult to know which one to »

MySQL JOIN a Table to Itself

When we think about joining tables with* JOIN* in MySQL, we usually have two or more tables that we want to link together based on common columns. Until I needed to do so recently, I didn't consider the idea of using a JOIN to join a table to itself, even »

Querying Data with MySQL Joins and Subqueries

This article provides an example to show how MySQL joins and subqueries can be used within a query to get database data. Let's say that you have two tables containing related information*. The first of these is called 'posts' and stores details about blog posts made on a site such »