After $db = Mysql->connect($host, $database, $user, $password);
add
$db->selectDB($database);
Here is a sub routine that I wrote that might be of some help. Allows you to modularize your sql queries.
sub dbQuery{
# Define data array, based on array passed into this subroutine
my...