duanfei1987 2015-10-25 11:33
浏览 80

致命错误:在[重复]中的非对象上调用成员函数FetchRow()

This question already has an answer here:

This is my error message Fatal error: 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

    while ($loly<$numdays){
        $income = 0;
        $cost = 0;
        $costs = 0;

        $dt = $yrs . '-' . $mnth . '-' . $loly;

        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
        }
</div>
  • 写回答

1条回答 默认 最新

  • donglei2288 2015-10-25 11:38
    关注

    This query:

    $this->sql = 'SELECT `unit_cost` FROM `care_tz_drugsandservices` WHERE `item_id` = '.$this->row[1];
    

    Doesn't return any rows. You can confirm this by testing it in phpMyAdmin. FetchRow doesn't handle these exceptions gracefully, so you will need to test the result of the query before starting to fetch rows.

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?