/**
  * Create a new contact record
  *
  * @param array Assoziative array with save data
  * @return The created record ID on success, False on error
  */
 function insert($save_data, $check = false)
 {
     if (is_object($save_data) && is_a($save_data, rcube_result_set)) {
         return $this->insert_recset($save_data, $check);
     }
     $insert_id = $existing = false;
     if ($check) {
         $existing = $this->search('email', $save_data['email'], true, false);
     }
     $a_insert_cols = $a_insert_values = array();
     foreach ($this->table_cols as $col) {
         if (isset($save_data[$col])) {
             $a_insert_cols[] = $this->db->quoteIdentifier($col);
             $a_insert_values[] = $this->db->quote($save_data[$col]);
         }
     }
     if (!$existing->count && !empty($a_insert_cols)) {
         $this->db->query("INSERT INTO " . $this->db_name . "\n         (user_id, changed, del, " . join(', ', $a_insert_cols) . ")\n         VALUES (?, " . $this->db->now() . ", 0, " . join(', ', $a_insert_values) . ")", $this->user_id);
         $insert_id = $this->db->insert_id(get_sequence_name('contacts'));
     }
     return $insert_id;
 }
Beispiel #2
0
 /**
  * Get last inserted record ID
  * For Postgres databases, a sequence name is required
  *
  * @param  string  Table name (to find the incremented sequence)
  * @return mixed   ID or FALSE on failure
  * @access public
  */
 function insert_id($table = '')
 {
     if (!$this->db_handle || $this->db_mode == 'r') {
         return FALSE;
     }
     if ($table) {
         if ($this->db_provider == 'pgsql') {
             // find sequence name
             $table = get_sequence_name($table);
         } else {
             // resolve table name
             $table = get_table_name($table);
         }
     }
     $id = $this->db_handle->lastInsertID($table);
     return $this->db_handle->isError($id) ? null : $id;
 }
Beispiel #3
0
                            <div class="table-responsive">
                                <table class="table table-bordered table-striped table-hover">
                                    <thead>
                                        <tr class="system">
                                            <th>#</th>
                                            <th> Main case sequence </th>
                                            <th> Input module </th>
                                            <th style="width:135px;">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                   
                                    
                                    <?php 
for ($i = 0; $i < count($module_list); $i++) {
    $sequence_name = get_sequence_name($module_list[$i]->Main_case_sequence_ID);
    ?>
                                        <tr id="row_<?php 
    echo $module_list[$i]->Case_Sequence_ID;
    ?>
">
                                            <td><?php 
    echo $i + 1;
    ?>
</td>
                                            <td><?php 
    echo $sequence_name;
    ?>
</td>
                                            <td><?php 
    echo $module_list[$i]->input_module;