AaronCrane.co.uk

Articles tagged “PHP”

How not to handle errors

Sometimes the code running a dynamic website will encounter errors. There are a variety of ways to handle runtime errors, of course. Some are better than others, and today I encountered a site that manages to get a surprising number of things wrong.

More…

Numbers and strings in MySQL

Here’s a MySQL query issued by some Perl code:

$db->do(q{
    CREATE TEMPORARY TABLE byline_age (
        byline_id int PRIMARY KEY,
        last_used int not null
    )
    SELECT byline_id, MAX(IfNull(published_at, ?)) AS last_used
    FROM article
    GROUP BY byline_id
}, undef, time());

Spot the bug? No, nor did I.

More…