$strBar="(SELECT COUNT(HNOPD_RECEIVE_HEADER.ReceiptNo) AS OPDLinegraph_general
FROM dbo.HNOPD_PRESCRIP INNER JOIN dbo.HNOPD_RECEIVE_HEADER
ON dbo.HNOPD_PRESCRIP.PrescriptionNo = dbo.HNOPD_RECEIVE_HEADER.PrescriptionNo
AND dbo.HNOPD_PRESCRIP.VN = dbo.HNOPD_RECEIVE_HEADER.VN
AND HNOPD_PRESCRIP.VisitDate = dbo.HNOPD_RECEIVE_HEADER.VisitDate
WHERE ((HNReceiptFormCode)<>'TR'
AND (HNReceiptFormCode)<>'13')
AND (CxlByUserCode) Is Null
AND SUBSTRING(RightCode,1,LEN(RightCode)/2)='1'
AND dbo.HNOPD_PRESCRIP.VisitDate
BETWEEN '".$year."-".$month."-1' AND '".$year."-".$month."-".$d_bar."')
UNION ALL
(SELECT COUNT(HNOPD_RECEIVE_HEADER.ReceiptNo) AS OPDLinegraph_insurance
FROM dbo.HNOPD_PRESCRIP INNER JOIN dbo.HNOPD_RECEIVE_HEADER
ON dbo.HNOPD_PRESCRIP.PrescriptionNo = dbo.HNOPD_RECEIVE_HEADER.PrescriptionNo
AND dbo.HNOPD_PRESCRIP.VN = dbo.HNOPD_RECEIVE_HEADER.VN
AND HNOPD_PRESCRIP.VisitDate = dbo.HNOPD_RECEIVE_HEADER.VisitDate
WHERE ((HNReceiptFormCode)<>'TR'
AND (HNReceiptFormCode)<>'13')
AND (CxlByUserCode) Is Null
AND SUBSTRING(RightCode,1,LEN(RightCode)/2)='2'
AND dbo.HNOPD_PRESCRIP.VisitDate
BETWEEN '".$year."-".$month."-1' AND '".$year."-".$month."-".$d_bar."')
UNION ALL
(SELECT COUNT(HNOPD_RECEIVE_HEADER.ReceiptNo) AS OPDLinegraph_partner
FROM dbo.HNOPD_PRESCRIP INNER JOIN dbo.HNOPD_RECEIVE_HEADER
ON dbo.HNOPD_PRESCRIP.PrescriptionNo = dbo.HNOPD_RECEIVE_HEADER.PrescriptionNo
AND dbo.HNOPD_PRESCRIP.VN = dbo.HNOPD_RECEIVE_HEADER.VN
AND HNOPD_PRESCRIP.VisitDate = dbo.HNOPD_RECEIVE_HEADER.VisitDate
WHERE ((HNReceiptFormCode)<>'TR'
AND (HNReceiptFormCode)<>'13')
AND (CxlByUserCode) Is Null
AND (SUBSTRING(HNOPD_RECEIVE_HEADER.RightCode,1,1)='3'
OR SUBSTRING(HNOPD_RECEIVE_HEADER.RightCode,1,1)='4'
OR SUBSTRING(HNOPD_RECEIVE_HEADER.RightCode,1,1)='6')
AND dbo.HNOPD_PRESCRIP.VisitDate
BETWEEN '".$year."-".$month."-1' AND '".$year."-".$month."-".$d_bar."')";
$objBar = odbc_exec($conn,$strBar) or die ("Error SQL [".$strBar."]");
$OPDLinegraph_general=0;
$OPDLinegraph_insurance=0;
$OPDLinegraph_partner=0;
while($objRow = odbc_fetch_object($objBar))
{
//echo $strBar."<br><br>";
$OPD_general = (int)$OPDLinegraph_general+$objRow->OPDLinegraph_general;
$OPD_insurance = (int)$OPDLinegraph_insurance+$objRow->OPDLinegraph_insurance; //line 90
$OPD_partner = (int)$OPDLinegraph_partner+$objRow->OPDLinegraph_partner; // line 91
echo "OPD_general =".$OPD_general."<br>";
echo "OPD_insurance =".$OPD_insurance."<br>";
echo "OPD_partner =".$OPD_partner."<br>";
$data[$year+543]['OPDLine_general'][$month]= $OPD_general;
$data[$year+543]['OPDLine_insurance'][$month]= $OPD_insurance;
$data[$year+543]['OPDLine_partner'][$month]= $OPD_partner;
Notice: Undefined property: stdClass::$OPDLinegraph_insurance in D:\Apache24\htdocs\Bootstrap\Statistics\insurance.php on line 90
Notice: Undefined property: stdClass::$OPDLinegraph_partner in D:\Apache24\htdocs\Bootstrap\Statistics\insurance.php on line 91
$strBar="select * from (SELECT COUNT(HNOPD_RECEIVE_HEADER.ReceiptNo) AS OPDLinegraph_general
FROM dbo.HNOPD_PRESCRIP INNER JOIN dbo.HNOPD_RECEIVE_HEADER
ON dbo.HNOPD_PRESCRIP.PrescriptionNo = dbo.HNOPD_RECEIVE_HEADER.PrescriptionNo
AND dbo.HNOPD_PRESCRIP.VN = dbo.HNOPD_RECEIVE_HEADER.VN
AND HNOPD_PRESCRIP.VisitDate = dbo.HNOPD_RECEIVE_HEADER.VisitDate
WHERE ((HNReceiptFormCode)<>'TR'
AND (HNReceiptFormCode)<>'13')
AND (CxlByUserCode) Is Null
AND SUBSTRING(RightCode,1,LEN(RightCode)/2)='1'
AND dbo.HNOPD_PRESCRIP.VisitDate
BETWEEN '".$year."-".$month."-1' AND '".$year."-".$month."-".$d_bar."')
UNION ALL
(SELECT COUNT(HNOPD_RECEIVE_HEADER.ReceiptNo) AS OPDLinegraph_insurance
FROM dbo.HNOPD_PRESCRIP INNER JOIN dbo.HNOPD_RECEIVE_HEADER
ON dbo.HNOPD_PRESCRIP.PrescriptionNo = dbo.HNOPD_RECEIVE_HEADER.PrescriptionNo
AND dbo.HNOPD_PRESCRIP.VN = dbo.HNOPD_RECEIVE_HEADER.VN
AND HNOPD_PRESCRIP.VisitDate = dbo.HNOPD_RECEIVE_HEADER.VisitDate
WHERE ((HNReceiptFormCode)<>'TR'
AND (HNReceiptFormCode)<>'13')
AND (CxlByUserCode) Is Null
AND SUBSTRING(RightCode,1,LEN(RightCode)/2)='2'
AND dbo.HNOPD_PRESCRIP.VisitDate
BETWEEN '".$year."-".$month."-1' AND '".$year."-".$month."-".$d_bar."')
UNION ALL
(SELECT COUNT(HNOPD_RECEIVE_HEADER.ReceiptNo) AS OPDLinegraph_partner
FROM dbo.HNOPD_PRESCRIP INNER JOIN dbo.HNOPD_RECEIVE_HEADER
ON dbo.HNOPD_PRESCRIP.PrescriptionNo = dbo.HNOPD_RECEIVE_HEADER.PrescriptionNo
AND dbo.HNOPD_PRESCRIP.VN = dbo.HNOPD_RECEIVE_HEADER.VN
AND HNOPD_PRESCRIP.VisitDate = dbo.HNOPD_RECEIVE_HEADER.VisitDate
WHERE ((HNReceiptFormCode)<>'TR'
AND (HNReceiptFormCode)<>'13')
AND (CxlByUserCode) Is Null
AND (SUBSTRING(HNOPD_RECEIVE_HEADER.RightCode,1,1)='3'
OR SUBSTRING(HNOPD_RECEIVE_HEADER.RightCode,1,1)='4'
OR SUBSTRING(HNOPD_RECEIVE_HEADER.RightCode,1,1)='6')
AND dbo.HNOPD_PRESCRIP.VisitDate
BETWEEN '".$year."-".$month."-1' AND '".$year."-".$month."-".$d_bar."'))";
Warning: odbc_exec(): SQL error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Executing SQL directly; no cursor., SQL state 01000 in SQLExecDirect in D:\Apache24\htdocs\Bootstrap\Statistics\growth_insurance_opd.php on line 80