Alternatively, create a configurable option, then add a "AfterShoppingCartCheckout" hook and then in your hook:
mysql_query('UPDATE tblhosting SET server = "' . $server . '" WHERE id = "' . $id . '"');
You haven't included all the code there so I'm making assumptions here, but my best guess is that you aren't creating the variable in the second function. The $subdomain variable only exists inside that first function, it won't exist in another unless you declare it, or make it global.