Displaying data from custom table

OK, so maybe the above wasn’t worded very well?

I have since made some progress as follows:

global $wpdb;    
$current_user = wp_get_current_user();
$uid = $current_user->ID;
$fname = $current_user->first_name . " " . $current_user->last_name;
$email = $current_user->user_email;

$studentTable = $wpdb->prefix.'um_metadata';


$result = $wpdb->get_results ( "SELECT * FROM $studentTable WHERE `user_id` = $uid AND 'um_key' = 'student_number' ");

foreach($result as $studentNumber){
    echo $studentNumber->um_value;
}

Quick context:

  • um_key column is the type of data (phone, address,
    etc.)
  • um_value is the column with the information

If I remove AND 'um_key' = 'student_number' from the SQL query, the result will spit out all the rows that have the correct user_id, but I am only looking to output the specific row that has the um_key ‘student_number’

Any help appreciated