How do I logically only update my variable when the value of RowCount is the largest one ever obtained?
Example:
I did the sql query and returned 15 records, saved 15 to the variable $maximo
so I made another query and returned 12 so I do not update the variable $maximo
, I made a third query and returned 17 then I update the variable $maximo
to 17.
Current status:
static function playeronline($pdoG)
{
try {
$playeronline = $pdoG->prepare("SELECT login FROM u_hero WHERE login = 1");
$playeronline->execute();
$numeroonline = $playeronline->rowCount();
$numeroonline = $numeroonline * 1.3;
$numeroonline = round($numeroonline);
return $numeroonline;
} catch (PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
}
I'm not sure how to start the maximum variable.