MySql’s last_insert_id always returns 0

“Aaaaagh!”, I was heard to scream several times. Why won’t the damn thing return the last id. I’m doing exactly as I’ve done a million times before, yet it aways returns a zero. I don’t have to be transaction based to use last_insert_id do I?!? Well, close actually. Not in a transaction, no. But on the same database connection. See, I was issuing an insert command via the phpMyAdmin program, then trying to get the last id in code.

So:

SELECT LAST_INSERT_ID();

…does indeed work. Grrr.