在前7次运行后,php函数无法正常工作

hi i have a function that gets Data from an ODBC connection

public function SageData() {
    $this->Arr = array();
    $conn = odbc_connect('Data hub', '', '');
    if (!$conn) {
        exit("Connection Failed: " . $conn);
    }
    $sql = "SELECT [SHOP FLOOR PRODUCTION PLAN].[MACHINE], [SHOP FLOOR PRODUCTION PLAN].[cycletime]
    FROM [SHOP FLOOR PRODUCTION PLAN]
     WHERE ((([SHOP FLOOR PRODUCTION PLAN].[MACHINE])='$this->name'));

";

    $rs = odbc_exec($conn, $sql);
    if (!$rs) {
        exit("Error in SQL");
    }

    while (odbc_fetch_row($rs)) {

        $this->Cycletime = odbc_result($rs, "cycletime");
    }

    odbc_close($conn);
    return round($this->Cycletime, 2);
}

This function is part of a class below is the code to create a new object in the class, In the function the $this->name corresponds to the ZW01001 and so on numbers

Machinecycle("ZW01001", "ZW01001Percent", 0);
Machinecycle("ZW01004", "ZW01004Percent", 1);
Machinecycle("ZW01005", "ZW01005Percent", 2);

the function is called by another function in the class to turn the data in to a percentage i can use see below

public function GetM() {

    $q = $this->Cycle();
    $qq = $this->SageData();

    $this->M = $q - $qq;
  //  $this->P = $this->M / $this->sageData();

    if ($qq == 0) {
        $this->P = 0;
    } else {
        $this->P = $this->M / $this->sageData();
    }

    return round($this->P, 2);
}

The Values outputted by GetM are put in to an array, my problem is that when i run this i get the data for the first 7 out of 14 objects and this error for the rest of them

Notice: Undefined property: machine::$Cycletime in C:\Somepath\Datatest.php on line 104

Line 104 is this part

    return round($this->Cycletime, 2);

What i do not understand is why it is doing this after the first 7 and failing on the rest the data is there

Well let's first state the obvious, in this bit

return round($this->Cycletime, 2);

$this->Cycletime seems to be undefined at the point where it spams the errors.

Next i see that this Cycletime is received from your odbc connection.

$this->Cycletime = odbc_result($rs, "cycletime");

Have you in fact checked that it is set all the time? because it looks like the query simply isn't returning data. So in order to fix it, make sure that your query does what it is supposed to and delivers the Cycletime.