I am having an issue with using global variables to get values inserted into my custom database table:

```
// example that does not work 
$user = wp_get_current_user();
$mega = $user->user_login;   // this values will return blank when
                             // inserted into database especially 
                             // when used with an if statement. 

```

The values work fine within the code in making a database query, but once inserted into the database it returns a blank empty value.

```
    // here is my full code
    global $wp;
    $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,
        )); 
    }

```