'addBranch') { $query = 'select office_id_fk, o_addr, o_csz, o_phone from ohs_office_branch where id = \'' . $selBranchID . '\''; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); list ($selOfficeID, $o_addr, $o_csz, $o_phone) = $res->fetch_row(); $query = 'select count(*) from ohs_office_branch where office_id_fk = \'' . $selOfficeID . '\''; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); list ($count) = $res->fetch_row(); $query = 'select o_name, o_logo, o_logo_tw, o_url, showname, eachoffice, e_housing, realtor, realtor_mls 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, $o_logo, $o_logo_tw, $o_url, $showname, $eachoffice, $e_housing, $realtor, $realtor_mls) = $res->fetch_row(); $branchText = "$o_name"; } else { if ($action == 'addBranch' && $selBranchID) { $query = 'select office_id_fk, o_name, o_logo from ohs_office_branch ob, ohs_office oo where ob.id = \'' . $selBranchID . '\' and ob.office_id_fk = oo.id'; pecho($query); if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); list ($selOfficeID, $o_name, $o_logo) = $res->fetch_row(); } $query = 'select id sid, o_name so_name from ohs_office order by o_name'; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); while ($row = $res->fetch_assoc()) { extract($row); $offices[$sid] = $so_name; } $branchText = ''; } $mysqli->close(); if ($count == 1 || $action == 'addOffice') { $rdoEntryTypeO = ' checked'; $rdoEntryTypeB = ''; $branchText = ''; } elseif ($selOfficeID || $action == 'addBranch') { $rdoEntryTypeO = ''; $rdoEntryTypeB = ' checked'; } ?>