Fixed issues with trader_config.php

Attempt at passing $mysqli to functions failed so I just switched it to
using globals instead (not ideal but at least it works now).