I get an error when importing csv

1

hi I'm doing the export and import in php + mysql + csv of a table with several records some 3000 records another 10 and with those of 10 records exports and imports normal, with 3000 or 2000 records exports normal but I do not care and I get the following error please help me friends this is the error

Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\SISINVED\importData.php on line 62

this is my code

<?php
require_once 'dbconnecta.php';
   if(isset($_POST['importSubmit'])){
$csvMimes = array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain');
if(!empty($_FILES['file']['name']) && in_array($_FILES['file']['type'],$csvMimes)){
    if(is_uploaded_file($_FILES['file']['tmp_name'])){


        $csvFile = fopen($_FILES['file']['tmp_name'], 'r');



        fgetcsv($csvFile);


        $conexion->query("DELETE FROM  detalleinventarioinicial where idcolegio='$idcod' ");
         while(($line = fgetcsv($csvFile)) !== FALSE){


$conexion->query("INSERT INTO detalleinventarioinicial (idingreso, nro, codigo, descripcion, unidad,cantidad,marca,serie,color,tipo,procedencia,docingreso,numdocingreso,estado,observacion,idcolegio,idusuario,modificacion,bien,patrimonial,ano,idlaboratorio,canti,foto,modelo,dimension) VALUES ('".$line[0]."','".$line[1]."','".$line[2]."','".$line[3]."','".$line[4]."','".$line[5]."','".$line[6]."','".$line[7]."','".$line[8]."','".$line[9]."','".$line[10]."','".$line[11]."','".$line[12]."','".$line[13]."','".$line[14]."','".$line[15]."','".$line[16]."','".$line[17]."','".$line[18]."','".$line[19]."','".$line[20]."','".$line[21]."','".$line[22]."','".$line[23]."','".$line[24]."','".$line[25]."')");
              }

               fclose($csvFile);

            $qstring = '?status=succ';
        }else{
            $qstring = '?status=err';
        }
    }else{
        $qstring = '?status=invalid_file';
    }
}

header("Location: adimportarinventario1.php".$qstring);?>
    
asked by deivid7777 19.11.2017 в 10:51
source

1 answer

0

Look at this link. The answer says that you can change the default script's timeout setting, which by default is 30 seconds. link I do not program in php, but I think it refers to this: link I hope it serves you.

    
answered by 19.11.2017 / 11:16
source