CLASS_MYSQLI::create_index PHP Метод

create_index() публичный Метод

public create_index ( $index, $table, $data, $type = "BTREE", $is_exists = false )
    function create_index($index, $table, $data, $type = "BTREE", $is_exists = false)
    {
        if ($is_exists) {
            $sql = "DROP INDEX `" . $index . "` ON `" . $table . "`";
            $this->query($sql);
        }
        $sql = "CREATE INDEX `" . $index . "` ON `" . $table . "` (";
        $values = array();
        foreach ($data as $key => $value) {
            $values[] = "`" . $value . "` ";
        }
        $sql .= implode(",", $values);
        $sql .= ") USING " . $type . "";
        $this->db_rs = $this->query($sql);
        return $this->db_rs;
    }