Topic: Need a list/vector with all the usernames
I need a list or vector with all the registred users usernames in the forum. How do I do?
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 troubleshooting → Need a list/vector with all the usernames
I need a list or vector with all the registred users usernames in the forum. How do I do?
define('PUN_ROOT', './'); //change this to your forum's directory
require PUN_ROOT.'include/common.php';
$result = $db->query('SELECT username FROM '.$db->prefix.'users') or error('Unable to fetch user usernames', __FILE__, __LINE__, $db->error());
$usernames = $db->fetch_assoc($result);
That'll put all your users usernames in a $usernames array unless I've borked it somehow.
That gets the first username from the resultset and puts it into $usernames
You'd want to do a while loop to get it into an array
Gahaha, too right. I need caffeine.
define('PUN_ROOT', './'); //change this to your forum's directory
require PUN_ROOT.'include/common.php';
$result = $db->query('SELECT username FROM '.$db->prefix.'users') or error('Unable to fetch user usernames', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_assoc($result)) {
$usernames[] = $row['username'];
}
PunBB Forums → PunBB 1.2 troubleshooting → Need a list/vector with all the usernames
Powered by PunBB, supported by Informer Technologies, Inc.