Andrew McCombe

Full Stack Web Developer

How to import a Google Sitemap into a MySQL table

Here’s a quick snippet showing how to import a Google Sitemap file into a MySQL table. This is useful if you need to do anything with the urls such as scrape the pages or check for 301/302/404 results.

MySQL Foreign Key Tutorial

Here’s a quick tutorial on creating foreign keys with MySQL.


Today I learned that `FLUSH PRIVILEGES` isn’t needed by Scott Lindsey in the comments. After double checking locally that Scott was correct I looked it up and found a great explanation why MySQL FLUSH PRIVILEGES isn’t needed

Fix for MySQL error Code 1217 – A foreign key constraint fails

If you’re trying to update or drop a table in MySQL and you’re getting the error ‘Error Code: 1217. Cannot delete or update a parent row: a foreign key constraint fails’ you need to toggle the `foreign_key_checks` variable first.

MySQL Create Database with UTF8 Character Set Syntax

I always forget the MySQL create database with UTF8 character set syntax, so here it is.

Vagrant PHP and PuPHPet is the Dogs Bollocks!

In The Beginning… I’ve been a PHP Web Developer for a long long time and have spent many hours setting up development environments in order to practice my trade. From full blown towers running full cdrom installations of RedHat 6.2 through to a laptop running FreeBSD and then Slackware. I used to compile the LAMP […]

Install PHP and Mysql on OSX Mountain Lion

Install PHP and Mysql on OSX Mountain Lion I usually develop on an Ubuntu VM running in VirtualBox but have needed to install PHP and MySQL on OSX Mountain Lion on the MacBook Pro. Here’s a Github Gist from Aaron Brady with details on how to do it. Install Xcode, Command Line Tools, Xquartz (on […]

MySQL Stored Procedure tutorial

How to create and use a stored procedure in MySQL: mysql > CREATE TABLE team ( id INT(3) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, team_name VARCHAR(20) NOT NULL, position TINYINT(3) UNSIGNED NOT NULL) ENGINE=INNODB; INSERT INTO team (team_name, position) VALUES (‘McLaren’,1),(‘Ferrari’,2), (‘Brawn’,3), (‘Toyota’,4), (‘Red Bull’, 5), (‘Torro Rosso’, 6), (‘Williams’, 7), (‘Force India’,8), (‘BMW’, 9), […]