Forums

[resolved] Need to Convert Number to Username (3 posts)

  1. Tosh
    Member
    Posted 1 year ago #

    This is a odd request and I won't get into the background for it to much. I'm querying a database and it returns a number which is the userid.

    This variable contains the userid (for example 82)

    $result->data;

    What I need to do is convert that number to the username that matches that userid. Then echo out the username.

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

  3. Tosh
    Member
    Posted 1 year ago #

    Gah! lol Knew it was simple but I just couldn't find the right function. Thank you very much for the very speedy reply!

    This is the final code for those interested:

    $user_info = get_userdata($result->data);
    echo $user_info->user_login;

Topic Closed

This topic has been closed to new replies.

About this Topic