Reputation: 85
What is the most effecient, best and fastest way: Adding a 'banned(boolean)'-field to the user-table, or creating a brand new table called 'banned'?
Upvotes: 0
Views: 156
Reputation: 3380
If your banned users have only this single property (they are banned), then go for a field. For instance, when checking if he/she can access a page, you'll be able to do something like this (in PHP):
if ($f['banned']) {
die("Get out of here, you're banned!");
} else {
// Your logic for normal, i.e., non-banned users
}
where $f
is the array returned by PDO's fetch()
or an equivalent function.
If, however, you need some special processing for banned users (logging their IPs — and only their ones — or, for example, counting their trials to access your website) that would involve other data, then go for a table which should obviously contain a UserId
field to have a relation to the main users table. Then you'll need to join this table in each query when checking a user.
Upvotes: 1