MyBB Community Forums

Full Version: username taken
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi
I need your helps for my project.
I make a new php page.
this php page have got a input text.
when some guest enter a username in this input place, if username taken somebody page write this username taken sorry, else you are use this user name.

my question: How can I do this datebase query
example:
$query = $db->query("SELECT fid3 FROM ".TABLE_PREFIX."userfields WHERE ufid = '".$mybb->user['uid']."'");
$sex = $db->fetch_array($query);
echo "... and you are ".$sex['fid3'];


this query write your sex. I need username query.
thank you for your helps...
Something like....
$query = $db->query("SELECT username FROM ".TABLE_PREFIX."users WHERE uid = '".$mybb->user['uid']."'");
$user = $db->fetch_array($query);
echo "... and you are ".$user['username'];

Although if this is an addon to MyBB you already have the username as $mybb->user['username'] Smile