in reply to mySQL Query Problem

What error message is DBI giving you? Placeholder arguments are automatically escaped so I doubt that it's the "?" in $msg that's causing the problem.