致命错误:在非对象中调用成员函数FetchRow()

时间:2015-10-25 11:33:48

标签: php

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

    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
        }

1 个答案:

答案 0 :(得分:0)

此查询:

>> x = [70 65 45 45 65 45 67 65 45 60 70 65 45];
>> u = unique(x);
>> [~, ind] = max(histc(x, u));
>> s = find(u(ind) == x, 1, 'first');
>> y = [x(1:s) x([u(ind)*ones(1, s) x(s+1:end)] ~= u(ind))]
y =

    70    65    45    65    67    65    60    70    65

不返回任何行。您可以通过在phpMyAdmin中测试来确认这一点。 FetchRow不会优雅地处理这些异常,因此您需要在开始获取行之前测试查询结果。