Problems with simplexlsx

0

I am working with simplexlsx to pass my excel file to the database that I have, when I enter a database of 5 records it enters it without any problem but when trying with a database that has 4813 records, it only enters 3714 records of the 4813, does anyone have any idea why this happens ?, here I leave the code

<?php
 if (isset($_FILES['file'])) {

 require_once __DIR__ . '/simplexlsx.class.php';
if ( $xlsx = SimpleXLSX::parse( $_FILES['file']['tmp_name'] ) ) {
$total = $conn -> prepare("DELETE FROM procura");
$total->execute();
$stmt = $conn->prepare( "INSERT INTO procura (item, codigo_sap, descripcion, und, menor_precio, peso, volumen, provmenor, paisprov, nproceso, empresacon, econtra, fecha) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

$stmt->bindParam( 1, $item);
$stmt->bindParam( 2, $codsap);
$stmt->bindParam( 3, $desc);
$stmt->bindParam( 4, $und);
$stmt->bindParam( 5, $menor);
$stmt->bindParam( 6, $peso);
$stmt->bindParam( 7, $volumen);
$stmt->bindParam( 8, $provme);
$stmt->bindParam( 9, $provpis);
$stmt->bindParam( 10, $proceso);
$stmt->bindParam( 11, $econcur);
$stmt->bindParam( 12, $econtr);
$stmt->bindParam( 13, $fecha);
    foreach ( $xlsx->rows() as $k => $fields) {
        if($k== 0){ continue; }
        for ( $i = 0; $i < 1; $i ++ ) {
        $item = $fields[0];
        $codsap = $fields[1];
        $desc = $fields[2];
        $und = $fields[3];
        $menor = $fields[4];
        $peso = $fields[5];
        $volumen = $fields[6];
        $provme = $fields[7];
        $provpis = $fields[8];
        $proceso = $fields[9];
        $econcur = $fields[10];
        $econtr = $fields[11];
        $fecha = $fields[12];
        $stmt->execute();
   }
    }
    echo'   <script type="text/javascript">
    alert("Base de Datos subida con exito");
    window.location.href = "index.php";
</script>'; 
} else {
    echo SimpleXLSX::parse_error();
}
}?>
 <div class="row">
<div class="panel panel-default">
  <div class="panel-heading">
    <h1>Actualice su base de datos</h1>
  </div>
  <div class="panel-body">
    <div class="row">
        <div class="col-md-12">
            <div class="col-md-6">
                <h2>Seleccionar archivo de excel</h2>
            </div>
            <div class="col-md-6">
                <form method="post" enctype="multipart/form-data">
                    <label>*.XLSX </label>
                    <input type="file" name="file" class="pad" />
                    <input type="submit" value="Subir" />
                </form>
            </div>
        </div>
    </div>
  </div>

    
asked by Maria 26.07.2018 в 15:01
source

0 answers