Welcome Guest, Not a member yet? Register   Sign In
Trying to erase MySQL rows when demoting, or appointing userGroup
#1

[eluser]Unknown[/eluser]
Hey everyone, so I have an admin control panel where I edit a specific user and change their userGroup to either "user" or "admin", I also have a chat box inside each persons channel next to their stream.(this is a live streaming site). The problem is: lets say User Bill posts in Franks chat box (id 1),
This is saved in MySQL Table (chatUsers) as: Username: Bill, Type: user, ChannelID: 1

Now let's say I appoint User Bill as Admin...Bill goes back to Franks channel but does not have any admin powers, he does however have admin powers for every other channel. Why is this?

Because Bill is still stored as: "Username: Bill, Type: user, ChannelID: 1" in Franks channel.

So to sum it all up: When demoting someone or appointing them as admin, I would like to find all instances of that persons name in MySQL table "chatUsers" and erase it.

(Note: When I update a players (userGroup) it sets their rank in Table "user". Their name and rank will only show up in "chatUsers" if they post in a chat box.)

Here is the form that gets submitted to update the user:
Code:
<option value="admin" &lt;?=($users->userGroup == 'admin') ? 'selected="selected"' : null?&gt;>admin</option>

It gets transferred here to form_validation:
Code:
$this->form_validation->set_rules('userGroup', 'Usergroup', 'trim|required|strip_tags|xss_clean');
Code:
$rows['userGroup'] = $this->input->post('userGroup');

It gets transferred to db_users.php:
Code:
$this->hasColumn('userGroup','enum', null, array('values' => array('user','admin'), 'default' => 'user'));




Theme © iAndrew 2016 - Forum software by © MyBB