function cargamdb() { $path = reduce_double_slashes(FCPATH . '/uploads/traspasos'); $dirlocal = $path . '/gpt.mdb'; $mdb = mdb_open($dirlocal); if ($mdb === false) { return false; } //$tablas=mdb_tables($mdb); $tablas = array('pro'); foreach ($tablas as $tabla) { //echo $tabla.br(); $sistab = "gpt_{$tabla}"; $this->db->simple_query("TRUNCATE {$sistab}"); $tbl = mdb_table_open($mdb, $tabla); if ($tbl === false) { continue; } while ($row = mdb_fetch_assoc($tbl)) { $sql = $this->db->insert_string($sistab, $row); $ban = $this->db->simple_query($sql); if ($ban == false) { $error++; memowrite($sql, 'gpt_prod'); } } } }
<?php dl("mdbtools.so"); $db = mdb_open("test.mdb"); $tables = mdb_tables($db, true); foreach ($tables as $name) { echo "{$name}:\n"; $tab = mdb_table_open($db, $name); $n = 0; while ($row = mdb_fetch_assoc($tab)) { var_dump($row); $n++; } echo "Rows: {$n}\n\n"; mdb_table_close($tab); } mdb_close($db);