gpt4 book ai didi

php - fatal error : Call to a member function FetchRow() on a non-object

转载 作者:行者123 更新时间:2023-11-29 11:55:08 27 4
gpt4 key购买 nike

这是我的错误消息 fatal error :在第 749 行对 C:\AppServ\www\hfix\include\care_api_classes\class_mini_dental.php 中的非对象调用成员函数 FetchRow()

这是代码:

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
} }

最佳答案

假设文件 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 或其他一些非-作为失败指示的对象值。在盲目使用之前应该先检查返回值是否有错误。

另请参阅https://stackoverflow.com/a/12769983/1878262 [相关]

关于php - fatal error : Call to a member function FetchRow() on a non-object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33328308/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com