How to save the highest value of rowCount?

Asked

Viewed 64 times

0

I want to save in a variable the highest value ever obtained by rowCount I just don’t know how to make the logic.

Current consultation:

$playeronline = $pdoG->prepare("SELECT login FROM u_hero WHERE login = 1");
$playeronline->execute();
$numeroonline = $playeronline->rowCount();
return $numeroonline;
  • I can’t understand what you want to do.

  • rowCount counts how many lines the query has right? then I want to save the largest amount ever consulted and only update if rowCount gets a larger amount.

  • In other words, you want to keep registered the largest number of online players the site has ever had?

  • That’s right, I want to make like a play record.

  • @Evertonfigueiredo The answer solved your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.

1 answer

1

Actually this is unreliable. You should increment your own counter every time someone does the login, and decrease every time someone does the logout (manually or by inactivity). When increment it compares with the highest historical value and decides whether it is a new record or not.

  • The login is done inside the game I monitor it, so always when I load the page I make the query to the game bank and check the login if it is in 1, I do not know how to do manually.

  • Note that this can be very inefficient if you have large volume. Your question is not very clear, if you give her an improvement I try to improve the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.