function approveFamilyRequest($reqs) { foreach ($reqs as $req) { $requester = mysql_real_escape_string($req['requester']); $requested = mysql_real_escape_string($req['requested']); $house = mysql_real_escape_string($req['house']); if ($req['new_family'] == 1) { $checkFamily = sprintf("SELECT family_belongs FROM USER WHERE username='******'", $requester); $checkResult = getDBResultsArray($checkFamily); if (!$checkResult[0]['family_belongs']) { createFamily($requester, $house); } } //requested mentor $familyQuery = sprintf("UPDATE USER,\n\t\t\t\t\t\t\t\t\t(SELECT family_belongs FROM USER WHERE username='******') u2\n\t\t\t\t\t\t\t\t\tSET USER.family_belongs = u2.family_belongs\n\t\t\t\t\t\t\t\t\tWHERE USER.username='******'", $requester, $requested); $familyResult = getDBResultInserted($familyQuery); //mentee of requested mentor $familyQuery = sprintf("UPDATE USER,\n\t\t\t\t\t\t\t\t\t(SELECT family_belongs FROM USER WHERE username='******') u2\n\t\t\t\t\t\t\t\t\tSET USER.family_belongs = u2.family_belongs\n\t\t\t\t\t\t\t\t\tWHERE USER.username=(SELECT mentee_user FROM Matches \n\t\t\t\t\t\t\t\t\t\t\t\tWHERE mentor_user='******')", $requested, $requested); $familyResult = getDBResultInserted($familyQuery); $delReqQuery = sprintf("DELETE FROM Family_Request WHERE requester='%s' AND requested='%s'\n\t\t\t\t\t\t\t\t ", $requester, $requested); $delResult = getDBResultsArray($delReqQuery); $delReqQuery = sprintf("DELETE FROM Family_Request WHERE requested='%s'\n\t\t\t\t\t\t\t\t ", $requested); $delResult = getDBResultsArray($delReqQuery); } }
//createClass( $name, $required, $dependability ); break; case 5: //component fully submitted if ($ignore) { $noncompatible_components = array(); } createComponent($name, $family_id, $price, $description, $compatible_families, $noncompatible_components); break; case 6: //update class; don't create a new one createClass($name, $dependability, $id); break; case 7: //update family; don't create a new one createFamily($name, $class_id, $id); break; case 8: //update component; don't create a new one if ($ignore) { $noncompatible_components = array(); } createComponent($name, $family_id, $price, $description, $compatible_families, $noncompatible_components, $id); break; case 9: //remove class if ($delete) { removeClass($id); } break; case 10: