in reply to DBI error

It's probably not causing the error that you getting, but you my want to keep an eye on your NULLs.

'NULL' will be a literal, while NULL will be an actual database null.

Hanlon's Razor - "Never attribute to malice that which can be adequately explained by stupidity"