Browsing articles from "July, 2011"
Jul
21
2011

Simple (Advanced) Click Tracking Using PHP and MySQL

Track clicks using PHP

On a recent project, I was asked to record the pages that each user was navigating to in a secured special-purpose website.  Initially it seemed daunting, however I recalled a script I’d written to track email open rates using PHP. I am generally disinterested in maintaining a database table of pages, along with a second table of clicked links as I find it to be very inefficient, so I opted to create a simple pass-through […]

Jul
18
2011

Exploding a String using Multiple Delimiters Using PHP

Php Array output

Updated February 12th, 2013 to reflect Dave’s comment function below- A++ for simplicity! function explodeX( $delimiters, $string ) { return explode( chr( 1 ), str_replace( $delimiters, chr( 1 ), $string ) ); } $list = ‘Thing 1&Thing 2,Thing 3|Thing 4’; $exploded = explodeX( array(‘&’, ‘,’, ‘|’ ), $list ); echo ‘<pre>’; print_r($exploded); echo ‘</pre>’; Earlier today, I was looking for a simple function to explode text that was contained in string format to be output […]

Jul
17
2011

ExpressionEngine Vs. WordPress

Expressionengine VS Wordpress

Update: detailed instructions and a full script for migrating from EE to WP may now be found here. For nine months now, I’ve been working with ExpressionEngine (EE) for one of my employers websites.  Originally, I was very hesitant to make the dive into yet another content management system, and after 9 months- my hesitation was certainly merited! Expressionengine doesn’t specify that it lacks necessary functionality, it just makes it impossible to do whatever it […]

Jul
16
2011

Helpful MySQL Query Functions and Tips

In case you’re wondering, I don’t just spend a couple hours a week throwing random bits of code onto this blog- I spend anywhere between 60- 100 hours per week making code my bitch. But thousands of hours and millions of lines of code later, I’m still occasionally stuck trying to remember a query (but then again when you’ve got most of the MySQL manual embedded in your brain, the info becomes hard to sort […]

Jul
13
2011

MySQL Query Results From Date Range

MySQL Database Table

It’s often unnecessary to select EVERYTHING from the beginning of your database table when performing queries, and depending on how much information your database contains- you’re likely displaying more results than anyone cares about! But alas, there is a better way! The following queries are very straighforward, specifying that the query should scan your database table date field (‘date_field’) for results that are greater than, or equal to the current date and time (‘NOW()’), and […]