PHP删除dropdownlist从数据库中取出的2个项目

时间:2015-09-10 04:17:54

标签: php mysql csv

我是PHP的新手。这是一个现有系统。我被告知要从下拉列表中删除特别是2项。下拉项是从mysql数据库中获取的。下拉列表中目前有3个项目:ICD,产品和医生费用。我被告知要删除产品和医生费用。

PHP中的代码:

function split_csv_line($record) {
    $first = NULL;

    if (strlen($record) == 0) {
        return array('');
    }

    if ($record[0] === '"') {
        $first = '';
        $start = 1;

        while ($start < strlen($record)
            && ($end = strpos($record, '"', $start)) !== FALSE
            && $end < strlen($record) - 1
            && $record[$end + 1] !== ',')
        {
            if ($record[$end + 1] !== '"') {
                die("Found characters between double-quoted field and comma.");
            }

            $first .= substr($record, $start, $end - $start - 1);
            $start = $end + 2;
        }

        if ($start < strlen($record) || $end === FALSE) {
            die("Could not find end-quote for double-quoted field");
        }

        $first .= substr($record, $start, $end - $start - 1);

        if ($end >= strlen($record) - 1) {
            return array($first);
        }

        /* Assertion: $record[$end + 1] == ',' */
        $rest = substr($record, $end + 2);
    } else {
        $end = strpos($record, ',');

        if ($end === FALSE) {
            return array($record);
        }

        /* Assertion: $end < strlen($record) */

        $first = substr($record, 0, $end);
        $rest = substr($record, $end + 1);
    }

    $fields = split_csv_line($rest);
    array_unshift($fields, $first);
    return $fields;
}

这是MYSQL查询:

$code_types = array();
$default_search_type = '';
$ctres = sqlStatement("SELECT * FROM code_types WHERE ct_active=1 ORDER BY ct_seq, ct_key");
while ($ctrow = sqlFetchArray($ctres)) {
  $code_types[$ctrow['ct_key']] = array(
    'active' => $ctrow['ct_active'  ],
    'id'   => $ctrow['ct_id'  ],
    'fee'  => $ctrow['ct_fee' ],
    'mod'  => $ctrow['ct_mod' ],
    'just' => $ctrow['ct_just'],
    'rel'  => $ctrow['ct_rel' ],
    'nofs' => $ctrow['ct_nofs'],
    'diag' => $ctrow['ct_diag'],
    'mask' => $ctrow['ct_mask'],
    'label'=> ( (empty($ctrow['ct_label'])) ? $ctrow['ct_key'] : $ctrow['ct_label'] ),
    'external'=> $ctrow['ct_external'],
    'claim' => $ctrow['ct_claim'],
    'proc' => $ctrow['ct_proc'],
    'term' => $ctrow['ct_term'],
    'problem'=> $ctrow['ct_problem'],
    'drug'=> $ctrow['ct_drug']
  );

0 个答案:

没有答案