Need to get Subscription name by user_id

I am working on a project where I need to access the Subscription Name based off of the current user.

if (is_user_logged_in())

								// if the user is logged in, get the user credentials
								$cloud_user_login = $current_user->user_login;
								$cloud_user_id	  = $current_user->ID;

								global $wpdb;

								// now, use the user_id to get their subscription id from the sub_relationships table
									$querystring = "SELECT 'sub_id' FROM $wpdb->m_membership_relationships WHERE 'user_id' = $cloud_user_id";
									error_log( $querystring );
									global $wpdb;
									$user_subscription_level_id = $wpdb->get_results( $querystring );

									// once we have the sub id, we get the name

										$user_subscription_level_name =
											WHERE 'ID' = $user_subscription_level_id");


									error_log("No Access to the USER ID");

// Do a bunch of stuff, using the user credentials and the subscription name


Problem is, I can't find a way to access the membership tables directly using the queries above.

Is there a function that gets the sub name based off of the user id or login that I am not aware of?

If not, then please help me fix the query to be able to access the membership plugin db tables.

Thank you in advance.