query('delete from ohs_office_branch where o_addr = \'\' and o_csz = \'\' and o_phone = \'\''))) // printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); $query = 'select id from ohs_office_branch where office_id_fk = \'' . $office_id . '\' and o_addr = \'New branch\' and o_csz = \'\' and o_phone = \'\''; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); list ($branch_id) = $res->fetch_row(); if (!($branch_id)) { $query = 'insert into ohs_office_branch (id, office_id_fk, o_addr) values (null, \'' . $office_id . '\', \'New branch\')'; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); $branch_id = $mysqli->insert_id; } header("Location: upload_agency.html?b=$branch_id&o=$office_id"); } $agentMenuArray = $officeMenuArray = array(); $selOfficeID = ''; $action = 'Add'; if ($_GET['hc']) { header('Location: upload_agent.html?o=' . $_GET['oc'] . '&h=' . $_GET['hc']); } if ($_GET['oc'] <> $_GET['oo']) { header('Location: upload_agent.html?o=' . $_GET['oc']); } if ($_GET['o']) { $selOfficeID = $_GET['o']; $query = 'select id, h_name from ohs_hosts where office_id = \'' . $selOfficeID . '\' order by h_name'; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); while ($row = $res->fetch_assoc()) { extract($row); $agentMenuArray[$id] = $h_name; } $id = $h_name = ''; if ($_GET['h']) { $selHostID = $_GET['h']; if ($_GET['h'] <> 'add') { $query = 'select h.id h_id, h.h_name, h.h_title, h.h_note, h.h_phone, h.h_image, o.o_name from ohs_hosts h, ohs_office o where o.id = h.office_id and h.id = \'' . $selHostID . '\' order by h.h_name'; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); while ($row = $res->fetch_assoc()) { extract($row); } } } else { $query = 'select o_name from ohs_office where id = \'' . $selOfficeID . '\''; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); list ($o_name) = $res->fetch_row(); } $action = 'Edit'; } #else #{ $query = 'select id omaOfficeID, o_name omaOfficeName from ohs_office order by 2'; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); while ($row = $res->fetch_assoc()) { extract($row); $officeMenuArray[$omaOfficeID] = $omaOfficeName; } #} $mysqli->close(); $txtOfficeName = ($o_name) ? $o_name : ''; $txtAgentName = ($h_name) ? $h_name : ''; $txtTitle = ($h_title) ? $h_title : ''; $txtNote = ($h_note) ? $h_note : ''; $txtPhone = ($h_phone) ? $h_phone : ''; $anagency = ($txtOfficeName) ? $txtOfficeName : 'Add an agent'; ?>
|
Enter the agent details. Agent name is required. Title is 'Broker', 'Owner', 'CRS', or whatever else, and is not required. Note is a short statement to go with the agent. And phone is, well, phone number or numbers. |