以下语句不返回任何结果。我检查了SQL语句,它们是正确的,而且似乎也没有编码错误。
<?php
require_once "func.php";
require_once "websockets.php";
// private $curResultId;
// private $MaxResult;
// private $MinResult;
for( $i = 0; $i<5; $i++ ) {
$row = db_fetch_item("SELECT resultid FROM ResultPackage
where ResultPackage.slotid like '1'
and ResultPackage.PackageID like '1'
ORDER BY resultid desc LIMIT 1");
$this->MaxResult = $row['resultid'];
$row = db_fetch_item("SELECT resultid FROM ResultPackage
where ResultPackage.slotid like '1'
and ResultPackage.PackageID like '1'
ORDER BY resultid asc LIMIT 1");
$this->MinResult = $row['resultid'];
$this->curResultId = mt_rand($this->MinResult,$this->MaxResult);
var_dump($this->curResultId);
}
?>
请帮忙
最佳答案
什么是$this
?这是类方法的一部分还是仅此而已?如果不是类,则应使用其他变量代替$this
。
for($i=0; $i<5; $i++) {
$row = db_fetch_item("SELECT resultid FROM ResultPackage
where ResultPackage.slotid like '1'
and ResultPackage.PackageID like '1'
ORDER BY resultid desc LIMIT 1");
$MaxResult = $row['resultid'];
$row = db_fetch_item("SELECT resultid FROM ResultPackage
where ResultPackage.slotid like '1'
and ResultPackage.PackageID like '1'
ORDER BY resultid asc LIMIT 1");
$MinResult = $row['resultid'];
$curResultId = mt_rand($MinResult,$MaxResult);
var_dump($curResultId);
}
关于php - 带有mt_rand的Var_Dump,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41904840/