SA-MP Forums Archive
How to delete all banned accounts [MySQL] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to delete all banned accounts [MySQL] (/showthread.php?tid=656200)



How to delete all banned accounts [MySQL] - GospodinX - 09.07.2018

Hi guys,

I want to delete all banned accounts.I have two tables
1) users -For all users
2) banusers -For all ban users.

So,i want select all banned users( From table 'BanUsers' and delete then delete their account from table 'Users' )



For delete:
Код:
DELETE FROM `users` WHERE 'Name' = '?'
For Select all ban users
Код:
SELECT Name FROM `banusers`
I don't know to finish..


Re: How to delete all banned accounts [MySQL] - Calisthenics - 09.07.2018

The first query will delete the user completely.. What you need is to UPDATE users and set the column to not banned.

So basically, an example:
pawn Код:
UPDATE users SET banned=0 WHERE banned=1;
DELETE FROM banusers;
The first query depends on your table structure.


Re: How to delete all banned accounts [MySQL] - GospodinX - 09.07.2018

I want to delete the user completely...
And I have two tables..I need to load all banned accounts from 'banusers' and then delete their accounts in 'user' table..


Re: How to delete all banned accounts [MySQL] - Calisthenics - 09.07.2018

OK, I misunderstood. You need to join them. Again, I can only give examples as you do not post your database structure.
pawn Код:
DELETE FROM users u
INNER JOIN banusers bu ON bu.name=u.name;