Ver Mensaje Individual
  #11 (permalink)  
Antiguo 03/06/2009, 11:00
Avatar de darkleo
darkleo
 
Fecha de Ingreso: octubre-2007
Mensajes: 106
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: duda INSERT INTO

aqui esta
Código PHP:
<html>
<body>
<form action="load.php" method="post" enctype="multipart/form-data">
  Archivo a consultar:<input name="nameArchivo" type="file">
  <input type="submit" value="ok">
</form>

<?php
$connection 
mysql_connect("localhost""root""") or die ("Unable to connect to server");
$db mysql_select_db("test"$connection) or die ("Unable to select database");            
if(
$nameArchivo!="")
{
    
$archivofopen($nameArchivo"r"); 

#$fcontents = file ('fcontents');
#$fcontents = file ('./pr.csv');
       
for($i=0$i<sizeof($archivo); $i++){
             
$line trim($archivo[$i]);
             echo 
"$line<BR>";
             
$arr explode(";"$line);
             
print_r($arr); echo "<br>";
                         
print_r($file);
             echo 
"$arr";
         
$sql "insert into une values ("implode(","$arr).")";        
             
mysql_query($sql);
        
#     fclose($archivo);
             
echo $sql ."<br>\n";
             if(
mysql_error()) {
             echo 
mysql_error() ."<br>\n";
          }
         }
}
       
?>
</body>
</html>
__________________
Just LeO