-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecibe_excel.php
More file actions
43 lines (32 loc) · 1.04 KB
/
recibe_excel.php
File metadata and controls
43 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
require('config.php');
$tipo = $_FILES['dataCliente']['type'];
$tamanio = $_FILES['dataCliente']['size'];
$archivotmp = $_FILES['dataCliente']['tmp_name'];
$lineas = file($archivotmp);
$i = 0;
foreach ($lineas as $linea) {
$cantidad_registros = count($lineas);
$cantidad_regist_agregados = ($cantidad_registros - 1);
if ($i != 0) {
$datos = explode(";", $linea);
$nombre = !empty($datos[0]) ? ($datos[0]) : '';
$correo = !empty($datos[1]) ? ($datos[1]) : '';
$celular = !empty($datos[2]) ? ($datos[2]) : '';
$insertar = "INSERT INTO clientes(
nombre,
correo,
celular
) VALUES(
'$nombre',
'$correo',
'$celular'
)";
mysqli_query($con, $insertar);
}
echo '<div>'. $i. "). " .$linea.'</div>';
$i++;
}
echo '<p style="text-aling:center; color:#333;">Total de Registros: '. $cantidad_regist_agregados .'</p>';
?>
<a href="index.php">Atras</a>