lundi 29 juin 2020

Using SQL Query to Define min/max for Random_int

I am trying to use a SQL query to define min/max values for the radnom_int function.

private function doPreEventStart($user) {
    $MaxResult = db_fetch_item("SELECT max(resultid) FROM ResultPackage
      where ResultPackage.slotid like ‘%{$slot_id}'
      and ResultPackage.PackageID like '%{$user->packageid}%'
      ORDER BY resultid asc LIMIT 1")
    $MinResult = db_fetch_item("SELECT min(resultid) FROM ResultPackage
        where ResultPackage.slotid like ‘%{$slot_id}'
        and ResultPackage.PackageID like '%{$user->packageid}%'
        ORDER BY resultid asc LIMIT 1")
     $this->curResultId =  var_dump(random_int($MinResult,$MaxResult)
    }

So far this has not worked and I get the following errors when I try to run the file.

PHP Parse error:  syntax error, unexpected ';' in /var/www/html/VC/server-vc-RNG.php on line 761
PHP Parse error:  syntax error, unexpected '}' in /var/www/html/VC/server-vc-RNG.php on line 762
PHP Parse error:  syntax error, unexpected '}' in /var/www/html/VC/server-vc-RNG.php on line 762
PHP Parse error:  syntax error, unexpected '$MinResult' (T_VARIABLE) in /var/www/html/VC/server-vc-RNG.php on line 757

Please help me see the error.




Aucun commentaire:

Enregistrer un commentaire