brainonastick Posted January 31, 2012 Posted January 31, 2012 Hi there, I am trying to use FMEdit inside an else if based on the number of records found by an FMFind but it wont take: $courseid_1 = $_POST['courseid']; $updatecapacity=new FX($serverIP,$webCompanionPort); $updatecapacity->SetDBData('Course Information.fp7', 'Course Information'); $updatecapacity->SetDBPassword($webPW, $webUN); $updatecapacity->AddDBParam('Course_ID', $courseid_1); $updatecapacityResult=$updatecapacity->FMFind(); $returnedCount=$updatecapacityResult['foundCount']; echo $updatecapacityResult['errorCode']; foreach($updatecapacityResult['data'] as $key=>$updatecapacityData); $updatecapacity2=new FX($serverIP,$webCompanionPort); $updatecapacity2->SetDBData('Course Registration.fp7', 'Registration Info'); $updatecapacity2->SetDBPassword($webPW, $webUN); $updatecapacity2->AddDBParam('Calendar_ID', $courseid_1); $updatecapacity2->AddDBParam('Registration_Status', 'Confirmed'); $updatecapacity2Result=$updatecapacity2->FMFind(); $returnedCount2=$updatecapacity2Result['foundCount']; echo $updatecapacityResult['errorCode']; foreach($updatecapacity2Result['data'] as $key=>$updatecapacity2Data); $recordDetail = explode('.',$key); $current_id = $recordDetail[0]; if($returnedCount2 + '1' >= $updatecapacity['Maximum'][0]) { $update = new FX($serverIP,$webCompanionPort,'FMPro7'); $update -> SetDBData('Course Information.fp7', 'Course Information'); $update -> SetDBPassword('fmsadmin','fmsadmin'); $update -> AddDBParam('-recid', $current_id); $update -> AddDBParam('Course_Capacity_Paste', 'FULL/JOIN WAITING LIST TEST'); $update -> AddDBParam('Worked', 'Yes 1'); $updateResult = $update -> FMEdit(); echo $updateResult['errorCode']; $updateData = current($updateResult['data']); } else if( $returnedCount2 + '1' >= $updatecapacity['Maximum'][0] - 5) { $update = new FX($serverIP,$webCompanionPort,'FMPro7'); $update -> SetDBData('Course Information.fp7', 'Course Information'); $update -> SetDBPassword('fmsadmin','fmsadmin'); $update -> AddDBParam('-recid', $current_id); $update -> AddDBParam('Course_Capacity_Paste', 'FILLING FAST TEST'); $update -> AddDBParam('Worked', 'Yes 2'); $updateResult = $update -> FMEdit(); echo $updateResult['errorCode']; $updateData = current($updateResult['data']); } else if(($returnedCount2 + 1) < ($updatecapacity['Maximum'][0] - 5)) { $update = new FX($serverIP,$webCompanionPort,'FMPro7'); $update -> SetDBData('Course Information.fp7', 'Course Information'); $update -> SetDBPassword('fmsadmin','fmsadmin'); $update -> AddDBParam('-recid', $current_id); $update -> AddDBParam('Course_Capacity_Paste', 'SPACE AVAILABLE TEST'); $update -> AddDBParam('Worked', 'Yes 3'); $updateResult = $update -> FMEdit(); echo $updateResult['errorCode']; $updateData = current($updateResult['data']); } Any advice gratefully received.
webko Posted February 1, 2012 Posted February 1, 2012 Your for each also needs { } around it for a start... ie foreach($updatecapacityResult['data'] as $key=>$updatecapacityData) { //Other stuff }
Recommended Posts
This topic is 4748 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now