You are getting this error because ‘wpmyfirstplugin_createTable’ is called on register_activation_hook. This hook is called when a plugin is activated from dashboard and before declaring any variable. So when this function runs it does not get the table name parameter.