Knackered

Taking advantage of the long weekend, we stayed up later than usual last night watching rubbish on television. Definitely paying for it now though! We seem to have forgotten to tell Jon to have a lie-in, so he was up at the crack of dawn like usual…

It was a mixed bag on the telly last night. We watched a couple of Top Gear re-runs and then a documentary about Bill & Monica which was well put together and informative. Then came the rubbish – we ended up watching a documentary on Heidi Fleiss. It’s an interesting story, but the reporter didn’t have a clue what his focus was and the documentary wandered around as a result. In fact, by the end of the show, I had no respect for the journalist at all…

(Edited to include stuff I’d missed out!)

Ali & Simon's

wedding was great! The bride looked really beautiful as shown here:

Ali & Simon

There was plenty of champagne, wine and brandy at the reception and so we had a good time. We managed to catch up with not only Ali & Simon, but also Lee, Gill & Tim and Big Andy which was great! Big Andy’s been in the US for a fair old while now, but has managed to keep his British accent :)

PHP DB Error Reporting

I’ve been trying to improve the way we handle errors from a DB operation in PHP. We use ADODB for all our database access currently do stuff like:

$rs = $database->Execute($db)
      or die($database->ErrorMsg() . "<br>" . $sql .
      "<br>" . __FILE__ . " " . __LINE__)

Nothing wrong with this code, except that the die() statement has to be everywhere and if we ever want to change it, then we have to change it everywhere!

Looking through the docs for ADODB I discovered that if you include “adodb-errorhandler.inc.php” then if will report the error and die gracefully for you. However, it doesn’t tell you the file line number where the error happened. Having the file and line number where the error was generate is really useful, so I decided to fix the ADODB version. This turned out to be quite easy – all you need to do is use PHP’s debug_backtrace() to get the correct file and line number.

Having now implemented this, We can now write:

$rs = $database->Execute($db);

and know that if it fails, we’ll get a useful error message to debug from!

Travelling

I had to go to Swindon this morning for a meeting. The RAC travel planner said that it would take 1.5 hours to get there, so I allowed 1h 45m just in case. Of course it took just under an hour… Coming back took over 2 hours though, so I suppose, on average, it was right!