这是我的错误消息
致命错误:Call to a member function FetchRow() on a non-object in C:\AppServ\www\hfix\include\care_api_classes\class_mini_dental.php on line 749
这是代码:
if ($cc=='0'){$cc='1';} else{$cc='0';}
$this->sql='SELECT `encounter_nr`,`article_item_number`,`dosage`,`price` FROM `care_encounter_prescription` WHERE `bill_status` = "archived" AND `prescribe_date` = "'.$dt.'" ORDER BY encounter_nr ASC ';
$this->result=$db->Execute($this->sql);
$this->sql='SELECT DISTINCT(`encounter_nr`) FROM `care_encounter_prescription` WHERE `bill_status` = "archived" AND `prescribe_date` = "'.$dt.'" ORDER BY encounter_nr ASC ';
$this->newquery=$db->Execute($this->sql);
$patients = $this->newquery->RecordCount();
while($this->zrow = $this->result->FetchRow()){
$this->sql = 'SELECT `unit_cost` FROM `care_tz_drugsandservices` WHERE `item_id` = '.$this->row[1];
$this->lastquery=$db->Execute($this->sql);
if ($vx = $this->lastquery->FetchRow()) $cost = $vx[0];
else $cost = 0;
$costs += $this->row[2] * $cost; # dosage * cost
$income += $this->row[2] * $this->row[3]; # dosage * price
} }
答案 0 :(得分:1)
假设文件C:\AppServ\www\hfix\include\care_api_classes\class_mini_dental.php
的第749行在您的示例中引用此行...
if($this->row=$this->result->FetchRow()){
那你的问题是$this->result
不是一个对象。您在前一行分配$this->result
,返回值为$db->Execute($this->sql)
。因此,如果$db->Execute()
返回除object之外的任何内容,则会出现该错误。我的猜测是$db->Execute()
因某种原因无法执行查询,并返回boolean
false
或其他一些非对象值作为失败的指示。在盲目地使用它之前,你应该首先检查错误的返回值。