/*Check to see if this org had an upgrade during the current school year. If so, get that date.*/ $split_annual_report = 'N'; /*Subtract 1 from the 4 digit school year to get the begin year for the school year*/ $beginYear = ($schYear4 - 1) . '-07-01'; $endYear = $schYear4 . '-06-30'; $pre_upgrade_end = ''; /*This covers the entire day before the upgrade*/ $year_begin = $beginYear . ' 00:00:00'; $year_end = $endYear . ' 23:59:59'; $qUp = "SELECT id FROM `organization` WHERE id = ? AND dateNewUpgrade BETWEEN ? AND ?;"; /*prepare stmt*/ $stmtq = $dbLink->prepare($qUp); /*Bind the criteria param. We need the params bound twice because of the subquery for tot_sch_cost*/ $stmtq->bind_param('iss', $recordId, $beginYear, $endYear); /*Execute the stmt*/ $stmtq->execute(); /*Store result*/ $stmtq->store_result(); /*Check success*/ if($stmtq->num_rows > 0){ /*Bind results*/ $stmtq->bind_result($org_id); $split_annual_report = 'Y'; } /*Close the db connection*/ $stmtq->close();