Jump to content
MakeWebGames

Weird Situation


Lithium
 Share

Recommended Posts

A friend asked me for a little change on the users online to show only users active since a certain amount of days... so far so good, though there is 1 user that simply doesn't show.

Not even with direct input of the query on phpmyadmin.

Let's say the code is as follows

SELECT userid FROM users WHERE laston>unix_timestamp()-(1440*24*45)

Shows the list on the users active within 45days or less... but 1 player, inactive for 32 days, simply doesn't show!

I am pointing to an account problem, but as i have no access to the phpadmin, i'm only guessing. Anyone as any idea on what can cause the problem?

Link to comment
Share on other sites

Re: Weird Situation

A friend asked me for a little change on the users online to show only users active since a certain amount of days... so far so good, though there is 1 user that simply doesn't show.

wouldn't it be something like this..

SELECT * FROM users WHERE laston > (unix_timestamp() - 300) AND days_old > '2'

Link to comment
Share on other sites

Re: Weird Situation

 

A friend asked me for a little change on the users online to show only users active since a certain amount of days... so far so good, though there is 1 user that simply doesn't show.

wouldn't it be something like this..

SELECT * FROM users WHERE laston > (unix_timestamp() - 300) AND days_old > '2'

 

That would only show users that were last online on the last 5 minutes ;)

Link to comment
Share on other sites

Re: Weird Situation

 

A friend asked me for a little change on the users online to show only users active since a certain amount of days... so far so good, though there is 1 user that simply doesn't show.

wouldn't it be something like this..

SELECT * FROM users WHERE laston > (unix_timestamp() - 300) AND days_old > '2'

 

That would only show users that were last online on the last 5 minutes ;)

I thought that was u wanted, it seems like a pretty stupid idea otherwise.

 

$hour = 60*60*24; $howMany = 4;  // set the days
$stamp = $day * $howMany;
'SELECT * FROM users WHERE laston > (unix_timestamp() - '.$stamp.' )';'
Link to comment
Share on other sites

Re: Weird Situation

@POG using select * is not an option ;) as you should call things by their names as best practices say, also, if you read my post, i have no trouble making users to show up, only 1 specific user that is within the range for the SELECT, is not showing, not even placing the SELECT directly on the DB., but thx for the effort though :)

Link to comment
Share on other sites

Re: Weird Situation

An update...

laston value = 1229278774

SELECT userid FROM users WHERE laston > unix_timestamp()-(1440*24*amount_of_days) AND userid=XXX

Tends to NOT showing any results, up to 81 days, at 82 it gives a result as expected...

SELECT laston, unix_timestamp( ) - (1440 *24 *amount_of_days) FROM users WHERE userid=XXX

also shows the correct timestamped values!

Link to comment
Share on other sites

Re: Weird Situation

Seems i messed up calculating the seconds, though no one noticed it too.

Thanks everyone that somehow tried to give an hand to it.

SELECT userid FROM users WHERE (unix_timestamp() - laston) <= 86400*45

86400 = total seconds in a day

45 = days you want to get

If you want to show active users for a certain period only, just replace the 1st query on userlist for a query like that and you're done!

Once again thx :)

Link to comment
Share on other sites

Re: Weird Situation

 

no one was checking stufrf like taht cause you said it worked perfect except for one Person.......

 

But I'm glad you got it working.

One of those things that makes me angry with myself, lol !!! a few hours looking at it, a couple of persons also looked, no one noticed the bad math! out of the box, a pair of fresh eyes note the error on the spot!

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.

 Share

×
×
  • Create New...