Blog

We offer the articles below in the hope that they will be useful, but we cannot accept liability for any problems caused by the instructions that they contain. If you have a problem, question or feedback relating to one of our articles, please post a comment so that other readers can benefit. We regularly review comments and reply or update the articles, to ensure their continued usefulness. All articles are provided free, without any advertising or tracking, for the benefit of the technical community.

If you require paid commercial support, please contact us for assistance.

MySQL/MariaDB unable to execute: Unknown column in WHERE clause due to TRIGGER

A couple of times recently I’ve seen a mysterious error while developing PHP applications using MariaDB. The error logs show something like the following:

Unable to execute INSERT INTO user ( email, password ) VALUES ( :email, :password ). Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'email' in 'where clause'.

jQuery tablesorter custom sort based on time datetime

For data heavy web projects with data displayed in tables, I frequently use the jQuery tablesorter plugin to allow users to easily sort data without writing a lot of custom code or relying on server-side processing. The plugin autodetects many data types, including dates, but I wasn’t entirely happy with the built-in date processing on a project I recently worked on.

How to disable autocomplete for email input in HTML forms

Recently I was making a simple web form to allow admins of a site to create accounts for new users. The admin enters the email address of the new user. When the form is submitted, a random password is generated and emailed to the user. (This is for privacy/security: it prevents the admin from knowing another user’s password.) However, the admin needs to enter their own password when submitting the form. In other words, the email address and password fields in the form are for two different accounts.

How to add custom configuration options to phpMyAdmin on Debian/Ubuntu

By default, phpMyAdmin is missing a number of useful configuration options. When you install it from source, you can set these options by editing /path/to/phpmyadmin/config.inc.php. However, Debian and Ubuntu package up phpMyAdmin and store things in a slightly different place. This makes installation, update and maintenance much more convenient, but does make things slightly more confusing when you want to set custom options.

Syntax checking PHP, JavaScript, Python automatically with Git

When reviewing code, a simple first step in checking that it doesn’t include any errors is to run a syntax check. In this post, I outline how to set up tools to scan all the code in a directory for syntax errors, and how to run this scan automatically when committing your code to git. For simplicity’s sake I am assuming that you are running Ubuntu, but the principles apply to any development environment.

PHP

The command line version of PHP (package php7.x-cli) allows you to syntax check a single file:

Filtering email by country using SpamAssassin on Debian

In this post, I describe how to set up spam filtering rules based on the country that an email was sent from, using SpamAssassin. These notes are based on Debian Bookworm, but the principles are very similar for other versions of Debian and Ubuntu. If you run a mail server that primarily only receives mail from a few countries, this guide should be very helpful to you in the fight against spam.