Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function write_data($table_name)
 {
     if (!$this->is_initialized) {
         throw new extractor_not_initialized_exception();
     }
     $col_types = sqlite_fetch_column_types($this->db->get_db_connect_id(), $table_name);
     $sql = "SELECT *\n\t\t\tFROM {$table_name}";
     $result = sqlite_unbuffered_query($this->db->get_db_connect_id(), $sql);
     $rows = sqlite_fetch_all($result, SQLITE_ASSOC);
     $sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES (';
     foreach ($rows as $row) {
         foreach ($row as $column_name => $column_data) {
             if (is_null($column_data)) {
                 $row[$column_name] = 'NULL';
             } else {
                 if ($column_data == '') {
                     $row[$column_name] = "''";
                 } else {
                     if (strpos($col_types[$column_name], 'text') !== false || strpos($col_types[$column_name], 'char') !== false || strpos($col_types[$column_name], 'blob') !== false) {
                         $row[$column_name] = sanitize_data_generic(str_replace("'", "''", $column_data));
                     }
                 }
             }
         }
         $this->flush($sql_insert . implode(', ', $row) . ");\n");
     }
 }
Exemple #2
0
 protected function _fetchAll($result)
 {
     $rows = sqlite_fetch_all($result, SQLITE_ASSOC);
     // free result?
     // rewind?
     return $rows;
 }
 public function fetch($res)
 {
     $result = array();
     $rows = sqlite_fetch_all($res, SQLITE_ASSOC);
     foreach ($rows as $data) {
         $result[] = (object) $data;
     }
     return $result;
 }
 public function dump()
 {
     $res = sqlite_query($con, self::ALL_GET_SQL);
     foreach (sqlite_fetch_all($res, SQLITE_ASSOC) as $row) {
         $this->cache[$row['name']] = unserialize($row['name']);
         $this->valueTime[$row['name']] = $row['time'];
     }
     var_dump($this->cache);
 }
Exemple #5
0
 function fetchAll($type = SQLITE_BOTH)
 {
     if ($type == 1) {
         $type = SQLITE_ASSOC;
     } elseif ($type == 2) {
         $type = SQLITE_NUM;
     } elseif ($type == 3 || $type != SQLITE_BOTH) {
         $type = SQLITE_BOTH;
     }
     //
     return sqlite_fetch_all($this->query, $type);
 }
Exemple #6
0
 public function getAll($sql)
 {
     if ($sql) {
         $query = $this->query($sql);
         if ($query) {
             return sqlite_fetch_all($query);
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
 function fetchAll($query)
 {
     if ($this->handler) {
         $response = sqlite_query($this->handler, $query);
         if ($response) {
             return sqlite_fetch_all($response, SQLITE_ASSOC);
         } else {
             return false;
         }
     } else {
         die('データベースハンドラが見つかりません。');
     }
 }
function load_popular_db_data($type = SQLITE_NUM)
{
    $db = get_db();
    $result = sqlite_query($db, "select url, count(*) from access_info group by url", $type);
    $temp_arr = sqlite_fetch_all($result);
    $ret_arr = array();
    foreach ($temp_arr as $sub_arr) {
        list($url, $cnt) = $sub_arr;
        $ret_arr[$url] = $cnt;
    }
    arsort($ret_arr);
    return array("hot" => array_slice($ret_arr, 0, 10), "good" => array_slice($ret_arr, 10, 10), "all" => $ret_arr);
}
Exemple #9
0
 /**
  * Constructor method for the adapter.  This constructor implements the setting of the
  * 3 required properties for the object.
  * 
  * @param resource $d The datasource resource
  */
 function sqliteAdapter($d)
 {
     parent::RecordSetAdapter($d);
     // grab all of the rows
     $fieldcount = sqlite_num_fields($d);
     // loop over all of the fields
     for ($i = 0; $i < $fieldcount; $i++) {
         // decode each field name ready for encoding when it goes through serialization
         // and save each field name into the array
         $this->columns[] = sqlite_field_name($d, $i);
     }
     if (sqlite_num_rows($d) > 0) {
         $this->rows = sqlite_fetch_all($d, SQLITE_NUM);
     }
 }
Exemple #10
0
function jz_db_query($link, $sql)
{
    global $sql_type, $sql_pw, $sql_socket, $sql_db, $sql_usr;
    if (false !== ($res = jz_db_cache('query', $sql))) {
        return $res;
    }
    $results = @sqlite_query($link, $sql);
    if (!$results) {
        return false;
    }
    $res = sqlite_fetch_all($results, SQLITE_BOTH);
    $ret =& new sqlTable();
    $ret->data = $res;
    $ret->rows = sizeof($res);
    jz_db_cache('query', $sql, $res);
    return $ret;
}
 public function execSQL($query)
 {
     $result = sqlite_query($this->db, $query);
     return sqlite_fetch_all($result, SQLITE_ASSOC);
 }
function remove_project($id, $type = SQLITE_NUM)
{
    $db = get_db2();
    $result = sqlite_query($db, "delete from project_info where id='{$id}'", $type);
    return sqlite_fetch_all($result);
}
Exemple #13
0
 /**
  * Renvoie un tableau de toutes les lignes du jeu de résultat
  * 
  * @param integer $mode  Mode de récupération des données
  * 
  * @access public
  * @return array
  */
 function fetchAll($mode = null)
 {
     if (is_null($mode)) {
         $mode = $this->fetchMode;
     }
     return sqlite_fetch_all($this->result, $mode);
 }
<?php

define("CODEDB", "../data/code_db");
if ($db = sqlite_open(CODEDB, 0666, $sqliteerror)) {
    $result = sqlite_query($db, 'select language from code_info', SQLITE_ASSOC);
    $ret_array = sqlite_fetch_all($result);
    $lang_list = array();
    foreach ($ret_array as $row_array) {
        array_push($lang_list, $row_array["language"]);
    }
    foreach (array_unique($lang_list) as $lang) {
        echo "<input name='lang_type' type=radio for='{$lang}''>{$lang}";
    }
}
 public function selectArray($query)
 {
     $result = $this->query($query);
     if ($this->type == "PDO") {
         return $result->fetchAll();
     } else {
         if ($this->type == "SQLite3") {
             $arr = array();
             $i = 0;
             while ($res = $result->fetchArray()) {
                 $arr[$i] = $res;
                 $i++;
             }
             return $arr;
         } else {
             if ($this->type == "SQLite") {
                 return sqlite_fetch_all($result);
             }
         }
     }
 }
        reset($objects);
        rmdir($dir);
    }
}
$sql = sqlite_open("configs/data");
$info_results = sqlite_query($sql, "SELECT * FROM info");
$info = sqlite_fetch_all($info_results);
$dirs = scandir($info[3]['Value']);
foreach ($dirs as $dir) {
    if ($dir != "." && $dir != "..") {
        if (time() - filectime($info[3]['Value'] . "/{$dir}") > 3600) {
            rrmdir($info[3]['Value'] . "/{$dir}");
        }
    }
}
$dirs = scandir($info[4]['Value']);
foreach ($dirs as $dir) {
    if ($dir != "." && $dir != "..") {
        if (time() - filectime($info[4]['Value'] . "/{$dir}") > 3600) {
            rrmdir($info[4]['Value'] . "/{$dir}");
        }
    }
}
$compile_results = sqlite_query($sql, "SELECT * FROM compile");
$compile = sqlite_fetch_all($compile_results);
foreach ($compile as $id) {
    if (!is_dir($info[4]['Value'] . "/" . $id['ID'])) {
        sqlite_exec($sql, "DELETE FROM compile WHERE ID = " . $id['ID']);
    }
}
sqlite_close($sql);
Exemple #17
0
<?php

chdir(dirname(__FILE__));
// pres2 hack
$db = sqlite_open("./ip.db");
$res = sqlite_unbuffered_query("SELECT ip_start, ip_end \n\t FROM ip_ranges \n\t WHERE country_code=(SELECT id FROM country_data WHERE country_name='NEW CALEDONIA')", $db);
echo '<pre>';
print_r(sqlite_fetch_all($res, SQLITE_ASSOC));
echo '</pre>';
 /**
  * Fetch all rows from the last results.
  *
  * @param string $getnames
  * @return array rows
  *
  */
 function fetch_all_rows($getnames = "with_names")
 {
     $results = array();
     if ($this->num_rows() > 0) {
         if ($getnames != "no_names") {
             //                while($row = sqlite_fetch_array($this->sql_result, SQLITE_ASSOC)) {
             //                    $results[] = $row;
             //                }
             $results = sqlite_fetch_all($this->sql_result, SQLITE_ASSOC);
         } else {
             //                while($row = sqlite_fetch_array( $this->sql_result, SQLITE_NUM)) {
             //                    $results[] = $row;
             //                }
             $results = sqlite_fetch_all($this->sql_result, SQLITE_NUM);
         }
         return $results;
     } else {
         return false;
     }
 }
 function fetch_all()
 {
     $rows = sqlite_fetch_all($this->result_set_handle, SQLITE_ASSOC);
     return $rows;
 }
Exemple #20
0
 /**
  * Clean some cache records
  *
  * Available modes are :
  * Zend_Cache::CLEANING_MODE_ALL (default)    => remove all cache entries ($tags is not used)
  * Zend_Cache::CLEANING_MODE_OLD              => remove too old cache entries ($tags is not used)
  * Zend_Cache::CLEANING_MODE_MATCHING_TAG     => remove cache entries matching all given tags
  *                                               ($tags can be an array of strings or a single string)
  * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
  *                                               ($tags can be an array of strings or a single string)
  *
  * @param  string $mode Clean mode
  * @param  array  $tags Array of tags
  * @return boolean True if no problem
  */
 private function _clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
 {
     if ($mode == Zend_Cache::CLEANING_MODE_ALL) {
         $res1 = $this->_query('DELETE FROM cache');
         $res2 = $this->_query('DELETE FROM tag');
         return $res1 && $res2;
     }
     if ($mode == Zend_Cache::CLEANING_MODE_OLD) {
         $mktime = time();
         $res1 = $this->_query("DELETE FROM tag WHERE id IN (SELECT id FROM cache WHERE expire>0 AND expire<={$mktime})");
         $res2 = $this->_query("DELETE FROM cache WHERE expire>0 AND expire<={$mktime}");
         return $res1 && $res2;
     }
     if ($mode == Zend_Cache::CLEANING_MODE_MATCHING_TAG) {
         $first = true;
         $ids = array();
         foreach ($tags as $tag) {
             $res = $this->_query("SELECT DISTINCT(id) AS id FROM tag WHERE name='{$tag}'");
             if (!$res) {
                 return false;
             }
             $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
             $ids2 = array();
             foreach ($rows as $row) {
                 $ids2[] = $row['id'];
             }
             if ($first) {
                 $ids = $ids2;
                 $first = false;
             } else {
                 $ids = array_intersect($ids, $ids2);
             }
         }
         $result = true;
         foreach ($ids as $id) {
             $result = $result && $this->remove($id);
         }
         return $result;
     }
     if ($mode == Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG) {
         $res = $this->_query("SELECT id FROM cache");
         $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
         $result = true;
         foreach ($rows as $row) {
             $id = $row['id'];
             $matching = false;
             foreach ($tags as $tag) {
                 $res = $this->_query("SELECT COUNT(*) AS nbr FROM tag WHERE name='{$tag}' AND id='{$id}'");
                 if (!$res) {
                     return false;
                 }
                 $nbr = (int) @sqlite_fetch_single($res);
                 if ($nbr > 0) {
                     $matching = true;
                 }
             }
             if (!$matching) {
                 $result = $result && $this->remove($id);
             }
         }
         return $result;
     }
     return false;
 }
Exemple #21
0
 function write_data($table_name)
 {
     global $db;
     static $proper;
     if (is_null($proper)) {
         $proper = version_compare(PHP_VERSION, '5.1.3', '>=');
     }
     if ($proper) {
         $col_types = sqlite_fetch_column_types($db->db_connect_id, $table_name);
     } else {
         $sql = "SELECT sql\n\t\t\t\tFROM sqlite_master\n\t\t\t\tWHERE type = 'table'\n\t\t\t\t\tAND name = '" . $table_name . "'";
         $table_data = sqlite_single_query($db->db_connect_id, $sql);
         $table_data = preg_replace('#CREATE\\s+TABLE\\s+"?' . $table_name . '"?#i', '', $table_data);
         $table_data = trim($table_data);
         preg_match('#\\((.*)\\)#s', $table_data, $matches);
         $table_cols = explode(',', trim($matches[1]));
         foreach ($table_cols as $declaration) {
             $entities = preg_split('#\\s+#', trim($declaration));
             $column_name = preg_replace('/"?([^"]+)"?/', '\\1', $entities[0]);
             // Hit a primary key, those are not what we need :D
             if (empty($entities[1]) || strtolower($entities[0]) === 'primary' && strtolower($entities[1]) === 'key') {
                 continue;
             }
             $col_types[$column_name] = $entities[1];
         }
     }
     $sql = "SELECT *\n\t\t\tFROM {$table_name}";
     $result = sqlite_unbuffered_query($db->db_connect_id, $sql);
     $rows = sqlite_fetch_all($result, SQLITE_ASSOC);
     $sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES (';
     foreach ($rows as $row) {
         foreach ($row as $column_name => $column_data) {
             if (is_null($column_data)) {
                 $row[$column_name] = 'NULL';
             } else {
                 if ($column_data == '') {
                     $row[$column_name] = "''";
                 } else {
                     if (strpos($col_types[$column_name], 'text') !== false || strpos($col_types[$column_name], 'char') !== false || strpos($col_types[$column_name], 'blob') !== false) {
                         $row[$column_name] = sanitize_data_generic(str_replace("'", "''", $column_data));
                     }
                 }
             }
         }
         $this->flush($sql_insert . implode(', ', $row) . ");\n");
     }
 }
Exemple #22
0
 /**
  * Runs a query and returns all the data as an array
  * Argument : $query - SQL Query
  * Return : All the data is the result
  */
 function getAll($query)
 {
     $result = $this->getSql($query);
     $arr = sqlite_fetch_all($result, SQLITE_ASSOC);
     return $this->_stripSlashes($arr);
 }
        echo "<td><a href=\"view_check_phpdoc.php?sort={$type}&order={$order}\">{$info['label']}</a></td>";
    }
    echo '</tr>';
    foreach ($extensions as $extension => $stats) {
        echo "<tr class=\"h\">";
        echo "<td><a href=\"http://php.net/{$extension}\">{$extension}</a></td>";
        foreach ($errors as $type => $info) {
            echo "<td title=\"{$info['label']}\"" . ($stats['SUM(' . $type . ')'] ? ' class="err"><a href="view_check_phpdoc.php?restrict=' . $type . '#' . $extension . '">' . $stats['SUM(' . $type . ')'] . '</a>' : '> ') . "</td>";
        }
        echo "</tr>";
    }
    echo '</table>';
} else {
    $query = sqlite_query($dbhandle, 'SELECT * FROM reference WHERE ' . $restrict . ' = 1');
    $status = array();
    $result = sqlite_fetch_all($query, SQLITE_ASSOC);
    foreach ($result as $res) {
        $status[$res['extension']][$res['funcname']] = $res;
    }
    echo '<p>
 <dl>';
    echo "<dt>{$errors[$restrict]['label']} (<a href=\"{$_SERVER['PHP_SELF']}\">All</a>)</dt><dd>{$errors[$restrict]['description']}</dd>";
    echo ' </dl>
</p>';
    echo '<p>';
    foreach ($status as $extension => $functions) {
        $nb = count($functions);
        if ($nb != 0) {
            $funcn += $nb;
            $exts .= '<a href="#' . $extension . '">' . $extension . '</a> ';
        }
 function getAll($resultType = ANYDB_PREDEFINED_VALUE)
 {
     if ($resultType == ANYDB_PREDEFINED_VALUE) {
         $resultType = $this->prefResType;
     }
     $res = false;
     if ($this->result != null) {
         switch ($resultType) {
             case ANYDB_RES_ASSOC:
                 $res = @sqlite_fetch_all($this->result, SQLITE_ASSOC);
                 break;
             case ANYDB_RES_NUM:
                 $res = @sqlite_fetch_all($this->result, SQLITE_NUM);
                 break;
             case ANYDB_RES_BOTH:
                 $res = @sqlite_fetch_all($this->result, SQLITE_BOTH);
                 break;
             default:
                 $this->_addError('Result type not supported!', 'getAll()');
         }
     }
     return $res;
 }
 /**
  * Fetch multiple rows from a select query.
  *
  * @param string $key Cache key
  * @param int $expire Expiration time in seconds
  * @return array Rows
  */
 public function many($key = null, $expire = 0)
 {
     if (empty($this->sql)) {
         $this->select();
     }
     $data = array();
     $result = $this->execute($key, $expire);
     if ($this->is_cached) {
         $data = $result;
         if ($this->stats_enabled) {
             $this->stats['cached'][$this->key_prefix . $key] = $this->sql;
         }
     } else {
         switch ($this->db_type) {
             case 'pdo':
                 $data = $result->fetchAll(PDO::FETCH_ASSOC);
                 $this->num_rows = sizeof($data);
                 break;
             case 'mysqli':
                 if (function_exists('mysqli_fetch_all')) {
                     $data = $result->fetch_all(MYSQLI_ASSOC);
                 } else {
                     while ($row = $result->fetch_assoc()) {
                         $data[] = $row;
                     }
                 }
                 $result->close();
                 break;
             case 'mysql':
                 while ($row = mysql_fetch_assoc($result)) {
                     $data[] = $row;
                 }
                 mysql_free_result($result);
                 break;
             case 'pgsql':
                 $data = pg_fetch_all($result);
                 pg_free_result($result);
                 break;
             case 'sqlite':
                 $data = sqlite_fetch_all($result, SQLITE_ASSOC);
                 break;
             case 'sqlite3':
                 if ($result) {
                     while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
                         $data[] = $row;
                     }
                     $result->finalize();
                     $this->num_rows = sizeof($data);
                 }
                 break;
         }
     }
     if (!$this->is_cached && $key !== null) {
         $this->store($key, $data, $expire);
     }
     return $data;
 }
}
$email_text = str_replace('BUGS_CLOSED', $text, $email_text);
/****************************************************************************/
/**** Weekly notes stats ****************************************************/
/****************************************************************************/
// Note: notes_stats.sqlite is generated via web/doc/trunk/scripts/notes*.php
// It's used for other note related activities, but we're using it for this too.
$dbfile = SQLITE_DIR . 'notes_stats.sqlite';
$text = '';
if (is_readable($dbfile) && ($db = sqlite_open($dbfile, 0666))) {
    $seconds = 86400 * DAYS_LOOKUP;
    $sql = "SELECT who, count(*) as count FROM notes WHERE time > (strftime('%s', 'now')-{$seconds}) GROUP BY who ORDER BY count DESC";
    $res = sqlite_query($db, $sql);
    if ($res) {
        if (sqlite_num_fields($res) > 0) {
            $rows = sqlite_fetch_all($res, SQLITE_ASSOC);
            foreach ($rows as $row) {
                $text .= sprintf("%20s %5s\n", $row['who'], $row['count']);
            }
        } else {
            $text = 'No notes were edited last week. So sad. :(';
        }
    } else {
        $text = 'Unable to query the notes database';
    }
} else {
    $text = 'The notes data cannot be found';
}
$email_text = str_replace('NOTES_HANDLED', $text, $email_text);
/**** Misc ******************************************************************/
$email_text = str_replace('SVN_MODULES_LIST', implode($svn_modules, ', '), $email_text);
Exemple #27
0
 /**
  * Return an array of metadatas for the given cache id
  *
  * The array must include these keys :
  * - expire : the expire timestamp
  * - tags : a string array of tags
  * - mtime : timestamp of last modification time
  *
  * @param string $id cache id
  * @return array array of metadatas (false if the cache id is not found)
  */
 public function getMetadatas($id)
 {
     $tags = array();
     $res = $this->_query("SELECT name FROM tag WHERE id='{$id}'");
     if ($res) {
         $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
         foreach ($rows as $row) {
             $tags[] = $row['name'];
         }
     }
     $this->_query('CREATE TABLE cache (id TEXT PRIMARY KEY, content BLOB, lastModified INTEGER, expire INTEGER)');
     $res = $this->_query("SELECT lastModified,expire FROM cache WHERE id='{$id}'");
     if (!$res) {
         return false;
     }
     $row = @sqlite_fetch_array($res, SQLITE_ASSOC);
     return array('tags' => $tags, 'mtime' => $row['lastModified'], 'expire' => $row['expire']);
 }
Exemple #28
0
 function searchPost($keyword, $field, $method)
 {
     if (!$this->prepared) {
         $this->dbPrepare();
     }
     if (!in_array($field, array('com', 'name', 'sub', 'no'))) {
         $field = 'com';
     }
     if (!in_array($method, array('AND', 'OR'))) {
         $method = 'AND';
     }
     $keyword_cnt = count($keyword);
     $SearchQuery = 'SELECT * FROM ' . $this->tablename . " WHERE {$field} LIKE '%" . sqlite_escape_string($keyword[0]) . "%'";
     if ($keyword_cnt > 1) {
         for ($i = 1; $i < $keyword_cnt; $i++) {
             $SearchQuery .= " {$method} {$field} LIKE '%" . sqlite_escape_string($keyword[$i]) . "%'";
             // 多重字串交集 / 聯集搜尋
         }
     }
     $SearchQuery .= ' ORDER BY no DESC';
     // 按照號碼大小排序
     $line = $this->_sqlite_call($SearchQuery, array('Search the post failed', __LINE__));
     return sqlite_fetch_all($line, SQLITE_ASSOC);
 }
<?php

$sql = sqlite_open("configs/data");
$info_results = sqlite_query($sql, "SELECT * FROM info");
$info = sqlite_fetch_all($info_results);
if (!isset($_GET['id'])) {
    die("Illegal attempt to access downloader");
} else {
    if (!is_numeric($_GET['id'])) {
        die("Invalid File ID");
    }
}
$id = $_GET['id'];
$compile_results = sqlite_query($sql, "SELECT * FROM compile WHERE ID = {$id}");
$compile = sqlite_fetch_array($compile_results);
if ($compile === FALSE) {
    die("File ID not found or has expired");
}
$files = scandir($info[3]['Value'] . "/{$id}");
foreach ($files as $object) {
    if ($object != "." && $object != "..") {
        if (pathinfo($info[3]['Value'] . "/{$id}/" . $object, PATHINFO_EXTENSION) == "amxx" or pathinfo($info[3]['Value'] . "/{$id}/" . $object, PATHINFO_EXTENSION) == "smx") {
            $file[] = $object;
        }
    }
}
if (count($file) == 1) {
    $filename = $file[0];
} else {
    switch ($compile['Type']) {
        case "zip":
Exemple #30
0
 $stout1 = $out->prepare($sql_tl_tmp);
 for ($i = 0; $i < count($TabIn); $i++) {
     // pour chaque ligne de la table sqlite_master - for each row of sqlite_master
     $stout1->execute(array($TabIn[$i]['type'], $TabIn[$i]['name'], $TabIn[$i]['tbl_name'], $TabIn[$i]['sql']));
 }
 for ($i = 0; $i < count($TabIn); $i++) {
     if ($TabIn[$i]['type'] == 'table') {
         // pour chaque vraie TABLE - for each real TABLE
         $createout = $TabIn[$i]['sql'];
         // commande SQL pour créer la table - SQL command in order to create the table
         $stcreateout = $out->prepare($createout);
         $stcreateout->execute();
         // dans la nouvelle base - in the new database
         $sqlins = "SELECT * FROM " . $TabIn[$i]['name'];
         $querysel = sqlite_query($in, $sqlins);
         $R = sqlite_fetch_all($querysel, SQLITE_NUM);
         $nbcol = count($R[0]);
         // nombre de colonnes de la table - number of columns of the table
         $C = array();
         for ($j = 0; $j < $nbcol; $j++) {
             $C[] = '?';
         }
         // $C = ['?', '?', ... , '?']  $nbcol time ;)
         $ch = "INSERT INTO " . $TabIn[$i]['name'] . " VALUES (";
         $ch = $ch . implode(",", $C) . ")";
         // $ch = 'INSERT INTO table VALUES (?,?, ... ,?)'
         $stinsout = $out->prepare($ch);
         // on prepare la requete d'insertion dans la nouvelle table
         if (count($R) > 0) {
             // si la table n'est pas vide - if table isn't empty
             for ($k = 0; $k < count($R); $k++) {