i have a function that is part of a class in php to get some data, it seems to be working for some but not others
i have an issue where it will get the first 6 or so records and the just return the rest as null Here is the Var_dump $this->sdata
string(6) "86.544"
Notice: Undefined property: machine::$sdata in C:\Documents and Settings\jKirkpatrick\My Documents\xammp\htdocs\Datatest.php on line 96
NULL
string(16) "181.090909090909"
string(5) "0.072"
string(3) "0.0"
string(7) "119.952"
string(3) "0.0"
Notice: Undefined property: machine::$sdata in C:\Documents and Settings\jKirkpatrick\My Documents\xammp\htdocs\Datatest.php on line 96
NULL
Notice: Undefined property: machine::$sdata in C:\Documents and Settings\jKirkpatrick\My Documents\xammp\htdocs\Datatest.php on line 96
NULL
Notice: Undefined property: machine::$sdata in C:\Documents and Settings\jKirkpatrick\My Documents\xammp\htdocs\Datatest.php on line 96
NULL
Notice: Undefined property: machine::$sdata in C:\Documents and Settings\jKirkpatrick\My Documents\xammp\htdocs\Datatest.php on line 96
NULL
Notice: Undefined property: machine::$sdata in C:\Documents and Settings\jKirkpatrick\My Documents\xammp\htdocs\Datatest.php on line 96
NULL
Notice: Undefined property: machine::$sdata in C:\Documents and Settings\jKirkpatrick\My Documents\xammp\htdocs\Datatest.php on line 96
NULL
public function SageData() {
$conn = odbc_connect('DATA HUB', '', '');
if (!$conn) {
exit("Connection Failed: " . $conn);
}
$sql = "SELECT `SHOP FLOOR PRODUCTION PLAN`.MACHINE, `SHOP FLOOR PRODUCTION
PLAN`.CODE, `SHOP FLOOR PRODUCTION PLAN`.DESCRIPTION, `SHOP FLOOR PRODUCTION
PLAN`.WONo, `SHOP FLOOR PRODUCTION PLAN`.Quantity, `SHOP FLOOR PRODUCTION
PLAN`.cycletime, `SHOP FLOOR PRODUCTION PLAN`.IMPS, `SHOP FLOOR PRODUCTION
PLAN`.Estimate
FROM `P:\ProductionControl\Production Planning\DATA HUB.mdb`.`SHOP FLOOR PRODUCTION
PLAN` `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->sdata = $this->SDtReading = odbc_result($rs, "cycletime");
}
return@ $this->sdata;
}
the data is there here are the expected results
86.544
181.0909091
0.072
0
119.952
0
72
32.76
799.992
36
39.6
29.988
The function is part of a class and run as Machinecycle("ZW01001", "ZW01001Percent", 0);
in the query $this->name would be "ZW01001"
And help as to debugging this would be greatly appreciated
while (odbc_fetch_row($rs)) {
$this->sdata = $this->SDtReading = odbc_result($rs, "cycletime");
var_dump($this->sdata);
}
return $this->sdata;
}
This with the Var dump in the while loop produces the same results as posted before without the NULL's
while (odbc_fetch_row($rs)) {
$this->sdata = $this->SDtReading = odbc_result($rs, "cycletime");
}
var_dump($this->sdata);
return $this->sdata;
}
This with the Dump out side the While produces the results exactly as posted before.