Why is values of a global variable returning blank when inserted into database

Please try with the updated code

// here is my full code
global $wpdb;
$user = wp_get_current_user();
$mega = $user->user_login;
$age = 19;

// if records were not found in the database 
// then insert new row with the details
if ( $age == 19) {
    $fillup = $wpdb->insert("markrecord_table", array(
        "username" => $mega,
        "post_id" => 340,
        "counted" => 1,
    )); 
}