This is where I keep code I use on a regular basis.

MySQL Custom Sort

Here’s something neat. If you want your SQL results in an order that’s not alphabetical or numerical, this little bit of code will allow you to specify what order you want your fields to appear.