本文整理汇总了PHP中dbase_add_record函数的典型用法代码示例。如果您正苦于以下问题:PHP dbase_add_record函数的具体用法?PHP dbase_add_record怎么用?PHP dbase_add_record使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbase_add_record函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adicionar
public function adicionar($array)
{
if (dbase_add_record($this->conexao, $array)) {
return true;
} else {
return false;
}
}
示例2: DBFAddRecord
function DBFAddRecord($add)
{
if (!is_array($add)) {
die("Tipe data bukan Array");
} else {
$ret = dbase_add_record($this->DBFCon, $add) or die("Gagal Menyimpan Data");
}
return $ret;
}
示例3: addPoint
function addPoint($row, $lon, $lat, $name)
{
global $shpFile, $dbfFile;
// Create the shape
$shp = ms_newShapeObj(MS_SHAPE_POINT);
$pt = ms_newPointobj();
$pt->setXY($lon, $lat, 0);
$line = ms_newLineObj();
$line->add($pt);
$shp->add($line);
$shpFile->addShape($shp);
dbase_add_record($dbfFile, array($row["station"], $name, $row["years"], $row["cvalid"], $row["high"], $row["low"], $row["precip"], $row["max_precip"], $row["max_precip_yr"], $row["max_high"], $row["max_low"], $row["min_high"], $row["min_low"], $row["max_high_yr"], $row["max_low_yr"], $row["min_high_yr"], $row["min_low_yr"]));
}
示例4: mspti
function mspti()
{
$this->layout = 'ajax';
$this->autoRender = FALSE;
// database "definition"
$def = array(array("KDYYSMSPTI", "C", 7), array("KDPTIMSPTI", "C", 6), array("NMPTIMSPTI", "C", 50), array("ALMT1MSPTI", "C", 30), array("ALMT2MSPTI", "C", 30), array("KOTAAMSPTI", "C", 20), array("KDPOSMSPTI", "C", 5), array("TELPOMSPTI", "C", 20), array("FAKSIMSPTI", "C", 20), array("TGPTIMSPTI", "D"), array("NOMSKMSPTI", "C", 30), array("EMAILMSPTI", "C", 40), array("HPAGEMSPTI", "C", 40), array("TGAWLMSPTI", "D"));
$epsbed_file = EPSBED_DIR . 'MSPTI.dbf';
if (!dbase_create($epsbed_file, $def)) {
echo "Error, can't create the database\n";
exit;
} else {
$db = dbase_open($epsbed_file, 2);
if ($db) {
$this->loadModel('Configuration');
$yys = $this->Configuration->getPTI();
$yys['YYS_KODE'] = '';
dbase_add_record($db, array($yys['YYS_KODE'], $yys['PTI_KODE'], $yys['PTI_NAMA'], $yys['PTI_ALAMAT_1'], $yys['PTI_ALAMAT_2'], $yys['PTI_KOTA'], $yys['PTI_KODE_POS'], $yys['PTI_TELEPON'], $yys['PTI_FAX'], str_replace('-', '/', $yys['PTI_TANGGAL_SK']), $yys['PTI_NOMOR_SK'], $yys['PTI_EMAIL'], $yys['PTI_WEBSITE'], str_replace('-', '/', $yys['PTI_TANGGAL_BERDIRI'])));
echo "<a href='files/epsbed/MSPTI.dbf'>Download file MSPTI.dbf</a>";
dbase_close($db);
}
}
}
示例5: crea_orden_pago
function crea_orden_pago()
{
$this->load->dbforge();
if (extension_loaded('dbase')) {
$item_orden = array(array('nro_op', 'N', 8, 0), array('orden_nro', 'C', 8), array('tipo_pres', 'C', 20), array('fecha_op', 'C', 10), array('benef_op', 'C', 50), array('cedb_op', 'C', 15), array('autor1_op', 'C', 50), array('compr_op', 'C', 20), array('monto_op', 'N', 10, 2), array('descrip_op', 'C', 1000));
if (!dbase_create('/tmp/orden_pago.dbf', $item_orden)) {
echo "Error, can't create the database\n";
} else {
$item_orden = dbase_open('/tmp/orden_pago.dbf', 2);
$query = "SELECT a.numero,a.numero numero2,a.fondo,a.fecha,c.nombre,c.rif,c.contacto,a.compromiso,a.total2,a.observa\n\t\t\t\tFROM v_pagos a \n\t\t\t\tJOIN sprv c ON a.cod_prov=c.proveed\n\t\t\t\tLEFT JOIN v_presaldo b ON a.codigoadm=b.codigoadm AND a.fondo=b.fondo AND a.codigopres=b.codigo\n\t\t\t\tWHERE MID(status,2,1) IN (2,3) \n\t\t\t\tGROUP BY a.numero";
$mSQL = $this->db->query($query);
$datos = array();
foreach ($mSQL->result() as $row) {
$datos[0] = $row->numero;
$datos[1] = $row->numero2;
$datos[2] = $row->fondo;
$datos[3] = $row->fecha;
$datos[4] = $row->nombre;
$datos[5] = $row->rif;
$datos[6] = $row->contacto;
$datos[7] = $row->compromiso;
$datos[8] = $row->total2;
$datos[9] = $row->observa;
dbase_add_record($item_orden, $datos);
}
dbase_close($item_orden);
}
}
$this->load->helper('download');
$data = file_get_contents("/tmp/orden_pago.dbf");
// Read the file's contents
$name = 'orden_pago.dbf';
force_download($name, $data);
unlink("/tmp/orden_pago.dbf");
}
示例6: exportToDbase
/**
* Export the data for a specific mouse over s specified time range to a dbase file
*
* @returns url of created dbase file
*/
function exportToDbase($rfid, $from, $to)
{
$parameters['rfid'] = $rfid;
$parameters['from'] = $from;
$parameters['to'] = $to;
$parameters["all"] = 1;
list($summary, $data) = $this->getRfidData($parameters);
if (sizeof($data) == 0) {
return null;
}
// boxes
$boxes = $summary['boxes'];
// where to store the files
$downloadXML = $this->configXML->xpath("//downloaddir");
$downloadDir = implode('', $downloadXML);
$downloadUrlXML = $this->configXML->xpath("//downloadurl");
$downloadURL = implode('', $downloadUrlXML);
// Adding data to dbf files
// definition for the dbf files
$def = array(array("ID", "N", 5, 0), array("RFID", "C", 10), array("YEAR", "C", 4), array("MONTH", "C", 2), array("TIME", "C", 8), array("DATETIME", "C", 19), array("BOX", "C", 2), array("ANTENNA", "C", 2), array("X", "N", 3, 0), array("Y", "N", 3, 0));
// create a dbf_file
//$dbf_file = $downloadDir.$rfid . "_" . $year . "_" . $month . ".dbf";
// $dbf_file = "data_for_" . $rfid . "_" . $from . "_" . $to . ".csv";
$filename = "data_for_" . $rfid . "_" . $from . "_" . $to . ".dbf";
$dbf_file = $downloadDir . $filename;
if (!dbase_create($dbf_file, $def)) {
return "Error, can't create the database: {$dbf_file}\n";
}
// open dbf file for reading and writing
$dbf_file = dbase_open($dbf_file, 2);
//$fh = fopen ($downloadDir.$dbf_file, "w");
// write data
// the datasets have the form: [rfid, antenna, box, time]
$id = 0;
foreach ($data as $dataset) {
list($rfid, $antenna, $unix_time) = $dataset;
$box = substr($antenna, 0, 2);
$datetime = date('Y-m-d H:i:s', $unix_time);
$month = date('m', $unix_time);
$year = date('Y', $unix_time);
$time = date('H:i:s', $unix_time);
$x = $boxes["{$box}"]['x'];
$y = $boxes[$box]['y'];
$dataset_converted = array($id, $rfid, $year, $month, $time, $datetime, $antenna, $box, $x, $y);
$str = implode(',', $dataset_converted) . "\n";
//fwrite($fh, $str);
dbase_add_record($dbf_file, $dataset_converted) or die("Could not add record to dbf file {$dbase_file}.");
$id++;
}
dbase_close($dbf_file);
//fclose($fh);
// returning url
return $downloadURL . $filename;
}
示例7: writeDbf
function writeDbf($dbfFileName, $dbfFieldList, $valueList)
{
$defList = array();
foreach ($dbfFieldList as $name => $def) {
$defList[] = array_merge(array(substr($name, 0, 10)), $def);
}
pm_logDebug(3, $defList, 'defList');
$dbfFile = dbase_create($dbfFileName, $defList);
//array(array('PROG_ID', 'N', 5, 0)));
foreach ($valueList as $row) {
pm_logDebug(3, $row, 'row');
dbase_add_record($dbfFile, $row);
}
dbase_close($dbfFile);
}
示例8: _saveDBFData
function _saveDBFData()
{
unset($this->DBFData["deleted"]);
if ($this->recordNumber <= dbase_numrecords($this->DBFFile)) {
if (!dbase_replace_record($this->DBFFile, array_values($this->DBFData), $this->recordNumber)) {
$this->setError("I wasn't possible to update the information in the DBF file.");
}
} else {
if (!dbase_add_record($this->DBFFile, array_values($this->DBFData))) {
$this->setError("I wasn't possible to add the information to the DBF file.");
}
}
}
示例9: OutSurgery
function OutSurgery($ADBF, $ACase, $ASurgery, $AService)
{
$vSMOList = locGetSMOList();
$vDocSeries = trim(str_replace('-', ' ', $ACase['doc_series']));
$vSpacePos = strpos($vDocSeries, ' ');
if ($vSpacePos === false) {
$vSerLeft = substr($vDocSeries, 0, 2);
$vSerRight = substr($vDocSeries, 2);
} else {
$vSerLeft = substr($vDocSeries, 0, $vSpacePos);
$vSerRight = substr($vDocSeries, $vSpacePos + 1);
}
$vBornDate = $ACase['born_date'];
if (empty($vBornDate)) {
$vBornDate = '0000-00-00';
}
$vBornDate = explode('-', $vBornDate);
if ($vBornDate[0] == '0000') {
$vBornDate[0] = '1901';
}
if ($vBornDate[1] == '00') {
$vBornDate[1] = '01';
}
if ($vBornDate[2] == '00') {
$vBornDate[2] = '01';
}
$vBornDate = implode('-', $vBornDate);
$vSurgeryDate = $ASurgery['date'];
// Trace(@$ACase['insurance_company_id'].'=->'.@$vSMOList[$ACase['insurance_company_id']]);
$vFirstDoctorId = $ACase['first_doctor_id'];
$CurrDoctorId = $ASurgery['user_id'];
$vRecord = array(FormatName($ACase['last_name']), FormatName($ACase['first_name']), FormatName($ACase['patr_name']), Date2DBF($vBornDate), $ACase['is_male'] ? 'м' : 'ж', 'э', strtoupper($ACase['polis_series']), strtoupper($ACase['polis_number']), '', '', $ACase['addr_reg_street'], '', '', $ACase['addr_reg_num'], $ACase['addr_reg_subnum'], $ACase['addr_reg_apartment'], 'аТрОт', CalcAge($vBornDate, $vSurgeryDate) >= 18 ? 'в' : 'д', Date2DBF($vSurgeryDate), Date2DBF($vSurgeryDate), '1', str_replace(' ', '', $ACase['diagnosis_mkb']), false, '', $ACase['doc_type_id'], $vSerLeft, $vSerRight, $ACase['doc_number'], FormatAddress(@$ACase['addr_reg_street'], @$ACase['addr_reg_num'], @$ACase['addr_reg_subnum'], @$ACase['addr_reg_apartment']), @$ACase['id'], 1, 0, 23, 'тр.' . @$ACase['id'], 118, 118, str_replace(' ', '', $ACase['diagnosis_mkb']), '', '', 16, 31, 31, 29, 1, 1, getUserEisCode($CurrDoctorId), getUserEisCode($vFirstDoctorId), '1', '1', 0, 0, 0, 0, 3, 5, 5, 0, 2, 0, 0, 0, 0);
$vOutRecord = array();
foreach ($vRecord as $vField) {
$vOutRecord[] = iconv('UTF-8', 'CP866', $vField);
}
dbase_add_record($ADBF, $vOutRecord);
}
示例10: incmapageometrias
function incmapageometrias($dir_tmp, $imgdir, $lista, $tipoLista = "stringArquivos")
{
$dir = $dir_tmp . "/" . $imgdir . "/";
$tituloTema = " geometria";
if ($tipoLista == "stringArquivos") {
$lista = explode(",", $lista);
$shapes = array();
$valoresoriginais = array();
foreach ($lista as $l) {
$geos = $this->unserializeGeo($dir . $l);
// pega todas as geometrias
foreach ($geos["dados"] as $geo) {
// echo $geo["wkt"]."<br>";
$shapes[] = ms_shapeObjFromWkt(str_replace("'", "", $geo["wkt"]));
foreach ($geo["valores"] as $v) {
$valorestemp[] = $v["item"] . "=" . $v["valor"];
}
$valoresoriginais[] = implode(" ", $valorestemp);
}
}
}
if ($tipoLista == "arraywkt") {
$shapes = array();
$valoresoriginais = array();
foreach ($lista as $l) {
$shapes[] = ms_shapeObjFromWkt($l);
}
}
if ($tipoLista == "marcadores") {
$shapes = array();
$valoresoriginais = array();
foreach ($lista as $l) {
$valoresoriginais[] = $l["nome"];
$p = explode(" ", $l["ext"]);
$l = "POLYGON ((" . $p[0] . " " . $p[1] . "," . $p[0] . " " . $p[3] . "," . $p[2] . " " . $p[3] . "," . $p[2] . " " . $p[1] . "," . $p[0] . " " . $p[1] . "))";
$shapes[] = ms_shapeObjFromWkt($l);
}
$tituloTema = " marcadores";
}
// verifica o tipo
if (count($shapes) == 0) {
return "erro.";
}
$tiposhape = $shapes[0]->type;
$tiposhapefile = MS_SHP_POLYGON;
if ($tiposhape == 0) {
$tiposhapefile = MS_SHP_MULTIPOINT;
}
if ($tiposhape == 1) {
$tiposhapefile = MS_SHP_ARC;
}
// cria o shapefile
if ($this->dbaseExiste == false) {
include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php";
}
$diretorio = dirname($this->arquivo);
$novonomelayer = nomeRandomico();
$nomeshp = $diretorio . "/" . $novonomelayer;
$l = criaLayer($this->mapa, $tiposhape, MS_DEFAULT, "Ins", "SIM");
$novoshpf = ms_newShapefileObj($nomeshp, $tiposhapefile);
$def[] = array("ID", "C", "250");
if ($this->dbaseExiste == false) {
$db = xbase_create($nomeshp . ".dbf", $def);
xbase_close($db);
} else {
$db = dbase_create($nomeshp . ".dbf", $def);
dbase_close($db);
}
// acrescenta os pontos no novo shapefile
$dbname = $nomeshp . ".dbf";
if ($this->dbaseExiste == false) {
$db = xbase_open($dbname, 2);
} else {
$db = dbase_open($dbname, 2);
}
$conta = 0;
foreach ($shapes as $s) {
$reg = array();
$reg[] = $valoresoriginais[$conta];
if ($this->dbaseExiste == false) {
xbase_add_record($db, $reg);
} else {
dbase_add_record($db, $reg);
}
$novoshpf->addshape($s);
$conta = $conta + 1;
}
if ($this->dbaseExiste == false) {
xbase_close($db);
} else {
dbase_close($db);
}
$l->set("opacity", 80);
$l->setmetadata("tema", $novonomelayer . $tituloTema);
$l->setmetadata("TEMALOCAL", "SIM");
$l->setmetadata("DOWNLOAD", "sim");
$l->set("data", $nomeshp);
$l->set("name", $novonomelayer);
$classe = $l->getclass(0);
$estilo = $classe->getstyle(0);
//.........这里部分代码省略.........
示例11: ms_newShapeFileObj
if ($format == "shapefile") {
/* Create SHP,DBF bases */
$filePre = "{$network}_locs";
if (!is_file("/var/webtmp/{$filePre}.zip")) {
$shpFname = "/var/webtmp/{$filePre}";
@unlink($shpFname . ".shp");
@unlink($shpFname . ".shx");
@unlink($shpFname . ".dbf");
@unlink($shpFname . ".zip");
$shpFile = ms_newShapeFileObj($shpFname, MS_SHP_POINT);
$dbfFile = dbase_create($shpFname . ".dbf", array(array("ID", "C", 6), array("NAME", "C", 50), array("NETWORK", "C", 20), array("BEGINTS", "C", 16)));
for ($i = 0; $row = @pg_fetch_array($result, $i); $i++) {
$pt = ms_newPointobj();
$pt->setXY($row["longitude"], $row["latitude"], 0);
$shpFile->addPoint($pt);
dbase_add_record($dbfFile, array($row["id"], $row["name"], $row["network"], substr($row["archive_begin"], 0, 16)));
}
unset($shpFile);
dbase_close($dbfFile);
chdir("/var/webtmp/");
copy("/mesonet/www/apps/iemwebsite/data/gis/meta/4326.prj", $filePre . ".prj");
popen("zip " . $filePre . ".zip " . $filePre . ".shp " . $filePre . ".shx " . $filePre . ".dbf " . $filePre . ".prj", 'r');
}
$table .= "Shapefile Generation Complete.<br>";
$table .= "Please download this <a href=\"/tmp/" . $filePre . ".zip\">zipfile</a>.";
chdir("/mesonet/www/apps/iemwebsite/htdocs/sites/");
} else {
if ($format == "awips") {
if (!$nohtml) {
$table .= "<pre>\n";
}
示例12: substr
$newrowid = substr($rowidop,3,4);
$vn=$rowsop["vn"];
$lenvn=strlen($vn);
if($lenvn=="1"){
$newvn="00".$vn;
}else if($lenvn=="2"){
$newvn="0".$vn;
}else if($lenvn=="3"){
$newvn=$vn;
}
$newseq=$newdateopd.$newvn.$newrowid; // SEQ Ц╙И╣ягА╩ц╧уИ╧сЮ╒Ир╒Имаые
$db6 = dbase_open($dbname6, 2);
if ($db6) {
dbase_add_record($db6, array(
$hn6,
$newdateopd,
$newclinic,
$oper6,
$newdropid,
$personid,
$newseq));
dbase_close($db6);
} //if db
} //while
//--------------------End DataSet6-------------------------//
} // if check box ╩т╢йь╢╥Ирб
?>
示例13: add
/**
* Add a new record to the database
* If it is an associative array, you must use get_empty_record()
* to ensure that everything is empty EXCEPT those in $row
*
* TODO: After it gets added, how do we know without doing a search?
* @param array $row an array of rows
* @param bool $fillempty do we populate the array with empty values? (using the header_info)
* @return bool true on added, false on failure (dbase_add_record() result)
*/
public function add($row, $fillempty = true)
{
$this->add_info = array();
if (is_assoc_array($row)) {
if ($fillempty) {
$new_row = $this->get_empty_record();
$this->add_info['invalid_key_count'] = 0;
//copy all values to the $new_row
foreach ($new_row as $k => $v) {
if (isset($row[$k])) {
$new_row[$k] = $row[$k];
} else {
$this->add_info['invalid_key_count']++;
}
}
//ok now $row should ONLY contain valid data
$row = $new_row;
}
//we can't add a deleted row, therefore:
unset($row["deleted"]);
// drop the field
$this->add_info['associative_row'] = $row;
// then convert to numeric to store:
$rarr = array();
foreach ($row as $i => $vl) {
$rarr[] = $vl;
}
$row = $rarr;
$this->add_info['row'] = $row;
}
//end if an associative array
//first convert record to a normal array (if it is associative)
$this->add_info['added'] = dbase_add_record($this->db, $row);
return $this->add_info['added'];
}
示例14: criaSHP
function criaSHP($tema, $map_file, $locaplic, $dir_tmp, $nomeRand = TRUE, $prj = "", $projetaToMap = true, $shapesSel = false)
{
include dirname(__FILE__) . "/../ms_configura.php";
$versao = versao();
$versao = $versao["principal"];
//para manipular dbf
if (file_exists($locaplic . "/pacotes/phpxbase/api_conversion.php")) {
include_once $locaplic . "/pacotes/phpxbase/api_conversion.php";
} else {
include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php";
}
$map = @ms_newMapObj($map_file);
$nameMapfile = $map->name;
substituiConObj($map, $postgis_mapa);
$layer = $map->getlayerbyname($tema);
//e necessario abrir ou nao vai projetar
$layer->open();
$prjMapa = $map->getProjection();
$prjTema = $layer->getProjection();
if ($prjTema != "") {
$projInObj = new projectionObj($prjTema);
$projOutObj = new projectionObj($prjMapa);
} else {
$projInObj = "";
$projOutObj = "";
$projetaToMap = false;
}
$layer->set("template", "none.htm");
$diretorio = dirname($dir_tmp);
$tipol = MS_SHP_POINT;
if ($layer->type == MS_LAYER_LINE) {
$tipol = MS_SHP_ARC;
}
if ($layer->type == MS_LAYER_POLYGON) {
$tipol = MS_SHP_POLYGON;
}
if ($nomeRand == true) {
$novonomelayer = $tema . "_" . nomeRandomico(5);
} else {
$novonomelayer = $tema;
}
$novonomelayer = str_replace(".", "-", $novonomelayer);
$nomeshp = $dir_tmp . "/" . $nameMapfile . "_" . $novonomelayer;
if (file_exists($nomeshp . ".shp")) {
return $nomeshp;
}
$novoshpf = ms_newShapefileObj($nomeshp, $tipol);
//se for do tipo features
$data = $layer->data;
$resultadoFinal = true;
if ($data == "") {
$def[] = array("ID", "C", "50");
$reg[] = 0;
if (!function_exists("dbase_create")) {
$db = xbase_create($nomeshp . ".dbf", $def);
xbase_add_record($db, $reg);
xbase_close($db);
} else {
$db = dbase_create($nomeshp . ".dbf", $def);
dbase_add_record($db, $reg);
dbase_close($db);
}
if ($versao >= 6) {
$shape = $layer->getshape(new resultObj(0));
} else {
$s = $layer->getfeature(0, -1);
$result = $layer->getResult(0);
$shpi = $result->shapeindex;
$shape = $layer->getfeature($shpi, -1);
}
$novoshpf = ms_newShapefileObj($nomeshp . ".shp", -2);
$novoshpf->addShape($shape);
$resultadoFinal = true;
} else {
if ($shapesSel == false) {
$shapesSel = retornaShapesSelecionados($layer, $map_file, $map, false);
}
$items = pegaItens($layer);
// cria o dbf
$def = array();
$cni = 0;
foreach ($items as $ni) {
$temp = strtoupper($ni);
$temp = substr($temp, 0, 8) . $cni;
//
//nao tem como descobrir o tamanho e tipo do campo
//
$def[] = array($temp, "C", "254");
$cni = $cni + 1;
}
if (!function_exists("dbase_create")) {
$db = xbase_create($nomeshp . ".dbf", $def);
} else {
$db = dbase_create($nomeshp . ".dbf", $def);
}
$dbname = $nomeshp . ".dbf";
$reg = array();
$novoshpf = ms_newShapefileObj($nomeshp . ".shp", -2);
$res_count = count($shapesSel);
if ($res_count > 0) {
//.........这里部分代码省略.........
示例15: exportarDbf
public function exportarDbf($maximo, $contador, $puntero, $limite, $anio, $ruta_db)
{
$where = $this->session->userdata('where');
$numRows = $this->mantenimiento_transito->getCantidad($where);
if ($ruta_db != '0') {
$ruta_db = str_replace("L", "/", $ruta_db);
} else {
$ruta_db = "";
}
if ($maximo == 0) {
if ($numRows->cantidad == 0) {
redirect(site_url('modulotransito/exportar'), 301);
}
$maximo = $numRows->cantidad;
$limite = ceil($maximo / 10);
$usuario = $this->session->userdata('usuario');
$NombreArchivo = $usuario . date("dmYHis") . ".dbf";
$ruta_dbO = getcwd() . "/basefuente/lesacctra.dbf";
$ruta_db = getcwd() . '/uploads/' . $NombreArchivo;
copy($ruta_dbO, $ruta_db) or die("no se pudo generar el molde");
// Abrir el archivo dbase
$dbh = dbase_open($ruta_db, 2) or die("¡Error! No se pudo abrir el archivo de base de datos dbase " . $ruta_db);
$row = $this->mantenimiento_transito->getDataDbf($where, $puntero, $limite);
foreach ($row as $data) {
dbase_add_record($dbh, array($data->fuen_finc, $data->hce, $data->hch, $data->ref_es, $data->referi, $data->ap_nm1, $data->ap_nm2, $data->nom_les, $data->cod_dir, $data->diresa, $data->red, $data->microred, $data->cod_eess, $data->eess, $data->dni, $data->edad, $data->tipo_edad, $data->sexo, $data->depar, $data->prov, $data->dis, $data->ubigeo, $data->tipo_loc, $data->direccion, $data->ing_eess, $data->hora, $data->dx1, $data->dx2, $data->dx3, $data->fech_egre, $data->cond_egr, $data->refer, $data->rehab, $data->fec_accd, $data->hor_accid, $data->lug_accid, $data->tipo_loc1, $data->depar_acc, $data->prov_acc, $data->dist_acc, $data->ubigeo_ac, $data->via_accd, $data->tp_accd, $data->movil, $data->nomovil, $data->veh_moto, $data->veh_nomoto, $data->peaton, $data->ub_les, $data->trasl_les, $data->tp_moto, $data->tp_nomoto, $data->tp_condi, $data->nom_condc1, $data->ape_condc, $data->nom_condc2, $data->ed_cond, $data->sex_cond, $data->lic_conduc, $data->comisar, $data->dep_com, $data->prov_com, $data->dist_com, $data->ubigeo_com, $data->alcoh, $data->num_pol, $data->num_plac, $data->nom_duepol, $data->aseg, $data->otroaseg, $data->ano, $data->estado, $data->fichanum, $data->tpa_otro, $data->evento));
$contador = $contador + 1;
}
dbase_close($dbh);
$puntero = $puntero + $limite;
$ruta_db = str_replace("\\", "L", $ruta_db);
$ruta_db = str_replace("/", "L", $ruta_db);
redirect("modulotransito/exportarDbf" . "/" . $maximo . "/" . $contador . "/" . $puntero . "/" . $limite . "/" . $anio . "/" . $ruta_db, 301);
} else {
// Abrir el archivo dbase
$dbh = dbase_open($ruta_db, 2) or die("¡Error! No se pudo abrir el archivo de base de datos dbase " . $ruta_db);
$row = $this->mantenimiento_transito->getDataDbf($where, $puntero, $limite);
foreach ($row as $data) {
dbase_add_record($dbh, array($data->fuen_finc, $data->hce, $data->hch, $data->ref_es, $data->referi, $data->ap_nm1, $data->ap_nm2, $data->nom_les, $data->cod_dir, $data->diresa, $data->red, $data->microred, $data->cod_eess, $data->eess, $data->dni, $data->edad, $data->tipo_edad, $data->sexo, $data->depar, $data->prov, $data->dis, $data->ubigeo, $data->tipo_loc, $data->direccion, $data->ing_eess, $data->hora, $data->dx1, $data->dx2, $data->dx3, $data->fech_egre, $data->cond_egr, $data->refer, $data->rehab, $data->fec_accd, $data->hor_accid, $data->lug_accid, $data->tipo_loc1, $data->depar_acc, $data->prov_acc, $data->dist_acc, $data->ubigeo_ac, $data->via_accd, $data->tp_accd, $data->movil, $data->nomovil, $data->veh_moto, $data->veh_nomoto, $data->peaton, $data->ub_les, $data->trasl_les, $data->tp_moto, $data->tp_nomoto, $data->tp_condi, $data->nom_condc1, $data->ape_condc, $data->nom_condc2, $data->ed_cond, $data->sex_cond, $data->lic_conduc, $data->comisar, $data->dep_com, $data->prov_com, $data->dist_com, $data->ubigeo_com, $data->alcoh, $data->num_pol, $data->num_plac, $data->nom_duepol, $data->aseg, $data->otroaseg, $data->ano, $data->estado, $data->fichanum, $data->tpa_otro, $data->evento));
$contador = $contador + 1;
}
dbase_close($dbh);
if ($puntero >= $maximo) {
$filename = $ruta_db;
if (file_exists($filename)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=lesacctra.dbf');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
ob_clean();
flush();
readfile($filename);
} else {
echo "el fichero no se creo";
}
unlink($filename);
redirect('modulotransito/exportar', refresh);
} else {
$puntero = $puntero + $limite;
$ruta_db = str_replace("\\", "L", $ruta_db);
$ruta_db = str_replace("/", "L", $ruta_db);
redirect("modulotransito/exportarDbf" . "/" . $maximo . "/" . $contador . "/" . $puntero . "/" . $limite . "/" . $anio . "/" . $ruta_db, 301);
}
}
}