excellent it works, on more question, a PHP/MySQL application just bombed out because there wasn't enough connections, could this be down to something in this code?
Do you mean it ran out of MySQL connections? Your code as it stands should not be using more connections than it was when running as a CGI. Are you using Apache::DBI?