The error is saying that $sth is undefined. I note you have $sth->execute() commented out in your script. My guess is that you should be calling $db->fetch_assoc($sth). If you can show us more of the fetch_assoc() method from modulename::DB that would help.