0

I have a table like this:

users
+----+-------+--------------+------------+--------+------------+
| id | name  |  cell_phone  | reputation | banned | date_time  |
+----+-------+--------------+------------+--------+------------+
| 1  | peter | 00982742843  | 3452       | 00000  | 1339412843 |
| 2  | jack  | 00973623452  | 43         | 00000  | 1339412431 |
| 3  | john  | 00674243444  | 994        | 00100  | 1339012356 |
+----+-------+--------------+------------+--------+------------+

Please focus on banned column. It is a BIT(5) data type. Each bit of those 5 bits declare a case. For example:

  • 00000 means that user can do any work on the website
  • 00100 means that user can do any work except voting on the website
  • 00101 means that user can do any work except both voting and commenting on the website

Ok well, when I ban a user in a field, I show him this message:

You have reached to vote (or whatever) limit. We ask that you wait 3 days before voting again.

Now my question is: How can I update banned column for that user and replace 00100 with 00000? Actually I can do updating that column, but my question is about doing that automatically in 3 next days. How can I do that?

Note: Using Cron Jobs isn't useful in my case. Because each user has its one time (I mean each user has a specific time to get ride of being ban, and that specific time is different for each user)

Martin AJ
  • 6,261
  • 8
  • 53
  • 111
  • 1
    Sounds like you will need one or more `DateTime` (not sure what they're called in MySQL but you get the idea) fields to indicate when these fields were either last updated or can be updated. Something like a `NoVotingUntil` and a `NoCommentingUntil` field. – Bob Kaufman Jun 14 '16 at 14:00
  • `Using Cron Jobs isn't useful in my case. Because each user has its one time.` That is not a problem for a cron job since you can setup a query to change it per user. Also a BIT type to identify such statuses is not a good idea (there is nothing wrong with it other than the difficult to read it.). – Jorge Campos Jun 14 '16 at 14:03

0 Answers0