MySQL: Create a Unique Composite Key

June 3, 2009

I have a lookup table where I am using a composite key which must be unique. I was not sure if MySQL was able to do this or not, but I very quickly found out. It is quite a simple operation actually. I already had a table in existence so I simply altered it. ALTER

Crazy NULLs in MySQL

May 27, 2009

The topic of MySQL and NULLs came up in my IRC room today. It turns out that MySQL tends to handle NULLs in a rather wonky way at times. Personally, I usually do not like allowing NULLs, and the only time they are ever present would be in a RIGHT or LEFT JOIN that had

Automatically Resize an IFrame From It’s Content

May 23, 2009

I recently had a situation with a client where I needed to use an iframe to pull content from a bulletin board into their main site template. Setting up the iframe was the easy part, then I noticed that the content would auto size the width, but it would not autosize the height. As I

PHP: Email Validation

May 15, 2009

There are an overwhelming number of regex sequences out there to validate an email address against, and frankly I get tired of running through them all trying to find one that fits my situation. I went looking for one that most closely follows the IETF rules and lo and behold I find a document describing

PHP: Random Password Generator

May 15, 2009

I find myself wanting random passwords all the time, and on a web project I needed to generate passwords automatically to send out to users. Here is the function I use to create random passwords automatically. /** * Creates a random password * * @param Integer $length – Default: 9 * @param Integer $strength –