您好我有以下代码:
private function doPreEventStart($user) {
$row = db_fetch_item("SELECT resultid FROM ResultPackage
where ResultPackage.slotid like '%{$this->curSlotId}'
and ResultPackage.PackageID like '%{$user->packageid}%'
ORDER BY resultid desc LIMIT 1");
$this->MaxResult = $row['resultid'];
$row = db_fetch_item("SELECT resultid FROM ResultPackage
where ResultPackage.slotid like '%{$this->curSlotId}'
and ResultPackage.PackageID like '%{$user->packageid}%'
ORDER BY resultid asc LIMIT 1");
$this->MinResult = $row['resultid'];
$this->curResultId = rand($MinResult,$MaxResult);
}
但是我收到了这个错误:
PHP注意:未定义的变量:第539行/var/www/html/betserver.php中的MinResult
PHP注意:未定义的变量:第539行/var/www/html/betserver.php中的MaxResult
请帮忙
答案 0 :(得分:3)
修复第539行以引用刚刚创建的类变量:
$this->curResultId = rand($this->MinResult, $this->MaxResult);
(注意每个之前添加$this->
)