Category Archives: PHP

Overriding PHP.INI

It’s a while since I’ve needed to override the php.ini file on a per-site basis, and I hadn’t realised that since PHP 5.3, the process has changed slightly. Now, if you want a local ini file to be read, you … Continue reading

Posted in PHP, Web development | Leave a comment

Timing it right

Apparently Americans have trouble with times expressed in 24-hour format and keep turning up at the wrong time as a result. Here’s yet another remedy for ludicrously over-complicated solutions to a simple date/time problem: $time = date(“g:i A”, strtotime(“17:30:00″)); That … Continue reading

Posted in PHP | Leave a comment

I love you PHP: more date goodness

Want to display a date in a language other than English, without switching your whole installation to some other language? It’s so easy … setlocale(LC_TIME, “fr_FR”); $datefacture = strftime(“%e %B %Y”); echo $datefacture;

Posted in PHP | Tagged , | Leave a comment

PHP date calculations: last day of the month

PHP’s date() function must be my favourite PHP function. You need never struggle with manipulating dates in PHP — if you need to use more than one line of code for working out a date, you probably just haven’t looked … Continue reading

Posted in PHP | Tagged | Leave a comment

Automatically updating a WordPress blogroll

Years ago, I signed up to a social bookmarking system called Spurl. I’m really not interested in social bookmarking, but it had a handy feature: by inserting a bit of Javascript in a web page, you could pull all or … Continue reading

Posted in Blogging, PHP, Web development, Wordpress | Tagged , , | Leave a comment

Book review: PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide, 4th Edition by Larry Ullman

I bought PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition) to use as a set book for an online intermediate PHP class that I teach. I previously used Web Database Applications with PHP & MySQL by … Continue reading

Posted in Databases, PHP, Web development | Tagged | Leave a comment

ADODB database abstraction library for PHP

I’ve been using this library for years to make my database interface code database-independent, but I am still discovering new useful functions. Case in point: today I was using the handy rs2csv function, which outputs a recordset to a CSV … Continue reading

Posted in Databases, PHP, Web development | Tagged , | Leave a comment

Preventing hotlinking of images

Using an .htaccess file to prevent people stealing bandwidth by linking directly to your images from another website is a popular and well-known technique. I needed to do this, but decided to take it a step further with a little … Continue reading

Posted in PHP, Web development | Tagged , , | Leave a comment

PHP: is it a leap year?

I’ve written about date manipulation in PHP before. There are some truly horrible hacks out there. Today I needed to detect whether a given year was a leap year, in order to write future-proof code for a calendar. PHP has … Continue reading

Posted in PHP | Leave a comment

Chocs To Go is here!

The goal for students on the intermediate PHP and MySQL course that I’m running for IWA/HWG is to create a working shopping cart. The course starts in only three days, and I decided I’d better walk the walk and prove … Continue reading

Posted in Databases, PHP, Web development | Tagged | Leave a comment