Fixed bugs due to mysql.php being included more than once. I should have been using include_once function in the php.