MyBB Community Forums

Full Version: Username Array
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to get the username of each user and get it in a neat array. Anybody could tell me how to go about this in php? Huh
$usernames = array();
$query = $db->simple_select("users", "username");
while($users = $db->fetch_array($query))
{
	$usernames[] = $users['username'];
}
$usernames = array();
$query = $db->simple_select("users","uid, username");
while($user = $db->fetch_array($query))
{
	$usernames[$user[uid]] = $user['username'];
}

i would do this so you can get the username with the uid
Probably; but that aint what he asked.
just giving more info for this array, maybe he wants it like that or your way.Wink
thx everyone! I figured it out. I used mysql_connect() and mysql_db_query() and mysql_fetch_assoc() to create an array of each user
(because it's being done outside the mybbsystem, on a modified version of mybb cellular)