Atlanta, Ga: php|works 2007
Local PHP geeks rejoice! php|works 2007 is happening in our neck of the woods in about a month. Speakers include Atlanta PHP founder Ben Ramsey, PHP guru Sara Goleman and security expert Chris...
View ArticleSolution for “Can’t connect to local MySQL server through socket...
If you’re trying to get up-and-running with PDO, you may experience a “Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’” error when trying to connect to your database, even if your...
View ArticleReview: Learning PHP Data Objects by Dennis Popel
Packt Publishing graciously provided me with a copy of this book to review. PHP supports more than a dozen database setups, including the SQLite library bundled with PHP 5. That’s a lot of databases,...
View ArticleTurn text files into pull down menus
UPDATE: This could also be done with the foreach() construct, but here — on my set-up at least — the for loop is a teensy bit faster. I developed this PHP function for a project I’m working on. I’m...
View ArticleDebugging tip: “Disallowed Key Character” error in CodeIgniter
After 6 hours of massive anxiety, stress, near tears, one pound on my desk, and some hair pulling, I tracked down the source of a nagging Disallowed Key Character error that I received while using...
View ArticleAtlanta, GA: php|works and PyWorks
Marco Tabini & Associates, publishers of PHP Architect and Python Magazine are bringing their php|works conference back to Atlanta this fall, November 12th through 14th, 2008. This year, though,...
View ArticleSimple pagination for arrays with PHP 5
While working on a recent project, I had to build a feature that displayed a list of files available in a directory. A simple way is just to use scandir() and a foreach loop to spit out a pretty list....
View ArticleCollecting e-commerce conversion data with Zen Cart and Google Analytics
Google Analytics allows you to collect pretty robust data about how users move through your e-commerce site. Here’s how to make it work with Zen Cart, an open source shopping cart. For this tutorial,...
View ArticlePHP: Sorting arrays randomly with array_randsort()
Or, you know, just use the shuffle() function. Kim points out the drawbacks of shuffle in the comments below. A custom PHP function. This function will return an array that’s been resorted in a random...
View Article[PHP quickie] Select a certain number of words from a string
An alternative to subst() that selects entire words rather than a specified number of characters. I used this on a recent project where I needed to create a meta tag description from text and HTML...
View ArticlePHP in Arabic: An interview with Khaled Al-Shamaa
PHP Classes interviews Khaled Al-Shamaa about his AR-PHP project, a series of PHP classes designed to handle Arabic-language web applications. Because Arabic uses a non-Latin character set, it presents...
View ArticleQuick tips for working with Amazon S3 and PHP
Try Donovan Schonknecht’s Amazon S3 PHP Class because it supports large uploads and doesn’t require PEAR. Set your Content-Disposition request header to ‘inline’ if you want files to display in your...
View ArticleCodeIgniter’s “Disallowed Key Characters” error revisited
Two years ago, I posted about CodeIgniter‘s “Disallowed Key Characters” error message, and one possible cause. Recently, I stumbled across another cause: disallowed characters in a POST array. In my...
View ArticleQuick PHP Tip: Uploading multiple files in HTML5
One of the neat things about HTML5 is that it allows for multiple file uploads in one file upload field. Of course, you have to have a browser that supports such a feature. Currently Opera 11.10 does....
View ArticlesetInterval in PHP
JavaScript has a native method for executing a function periodically: setInterval. But in PHP, it’s a little bit harder. PHP lacks a setInterval equivalent. The closest we can get are the sleep(),...
View Article