1
How do I logica so that only update my variable when the Rowcount value is the highest ever obtained?
Example:
I performed the sql query and returned 15 record, saved 15 in variable $maximo
then I performed another query and returned 12 so I do not update the variable $maximo
, performed a third query and returned 17 then i update the variable $maximo
to 17.
Current condition:
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 don’t know how to start the maximum variable.
Just check if the returned value is greater than what you have in the variable
$maximo
, but, it has how to put its code?– novic
So I don’t know how to start the maximum variable, I will change and put the current code.
– Everton Figueiredo