Jump to content
MakeWebGames

How Do I Delete The Inactive


SaMz

Recommended Posts

Re: How Do I Delete The Inactive

delete from users where laston < unix_timestamp() - 60 * 60 * 24 * 30

 

Take the current time, and subtract 30 days from it.

You're subtracting seconds, so you need 30 days worth of seconds: 60 seconds * 60 (minutes) * 24 (hours) * 30 (days)

 

now that you have a timestamp that points to 30 days ago, you simply need to see if laston is less than that.

"laston" may be a different column name, I'm not 100% if that's the right name for that as mccodes isn't what I work on day in day out.

Keep in mind, just deleting the users presents some problems. If they had a gang, and they were the leader, and no one else is in the gang, that gang will be stuck having 0000000000 members.

Any items they had for sale in the market will point to User=> []

Basically, it'll be empty. There's more things that happen, trust me. You really need to be thorough about removing all traces of the user, and not just their row in the users table.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...