WB2.8.1 used MySQL, where the current WB versions (and PHP) use MySQLi.
mysqli_query() needs the handle that was created when the connection to the database was made.
WB has the $database class you can use. The correct way would be:
// if you want to crash on errors (not recommended)
if($database->is_error()) die("Error: ".$database->get_error();