PHP Tutorials

Export Parts of MySQL Table to Excel CSV File Using PHP

Written by Andy on January 28, 2010 | No Comments |PHP Tutorials

This is a quick snippet of code I created to dynamically pull a user-defined query from a MySQL database and export it the a CSV file.

Function to Generate a PHP Random String of Numbers and Letters

Written by Andy on January 8, 2010 | No Comments |PHP Tutorials

Here’s a quick snippet of code that allows you to quickly generate a random string of letters and/or numbers based on the variables you feed into the function.

Convert a String into a Date with PHP

Written by Andy on September 30, 2009 | No Comments |PHP Tutorials

This problem came up while working with the Allegheny County Property database. They have a field for the sale date of the property, only they’re storing the date like this – 3291982 for 03/29/1982.

Working with Prices in PHP

Written by Andy on August 7, 2009 | No Comments |PHP Tutorials

Take an array of numbers, strip out the dollar sign and format them correctly.

This is useful when you are given prices as varchar or text with the dollar sign already included in the field. We’re going to start with an array of numbers, in this case we’ll use the array(‘$1256.45′,’$5564.75′,’$7895.33’).