Im currently working on a browser based game written in PHP. I have a db table called ‘user_accounts’ with every members details. Each game has its own user table ‘$db_name_users’ where ‘$db_name’ is a unique prefix added to each games db tables.
What Im trying to do currently is when a game is created, not only is the game Admin added as a user (that is fine) but also, all the server Admins are added aswell. Each user is defined by a power lvl (powers) in the user_accounts table. powers = 1 (server admin) powers = 2 (game admin) powers = 3 (regular user)
here is the code I came up with to do this:
[php]db(FILE,LINE,“SELECT login_id, login_name, email_address FROM user_accounts WHERE powers = 1”);
$server_ads = dbr();
while($server_ads) {
dbn(FILE,LINE,“INSERT INTO $_POST[_dbname]_users (login_id, login_name, cash, tech, genesis, terra_imploder, alpha, gamma, delta, sn_effect, grav_mine, hornet_mine, leech, email_address) VALUES (’$server_ads[login_id]’, ‘$server_ads[login_name]’, ‘99999999999’, ‘99999999’, ‘999999’, ‘999999’, ‘999999’, ‘999999’, ‘999999’, ‘999999’, ‘999999’, ‘999999’, ‘999999’, ‘$server_ads[email_address]’)”);
}[/php]
however this just tried to enter the same user repeatedly not each server admin.
i also tried :
[php]while($server_ads = dbr())[/php] instead of just [php]while($server_ads)[/php] and I got no SQL error, but only one entry was added when there are 4 users who meet the criteria. Any ideas anyone?