PHP - cargar archivo .txt a phpmyadmin o sqlyog

 
Vista:

cargar archivo .txt a phpmyadmin o sqlyog

Publicado por diego alejandro (1 intervención) el 28/10/2011 19:42:09
buenas dias.

quisiera recurrir a ustedes, ya que llevo mas de 1 semana intentando resolver este problema que tengo.

lo que me piden es que desde un archivo .txt con cierta informacion, crear un boton que me cargue ese archivo .txt, y la informacion que tenga ese .txt me la cargue en phpmyadmin o sqlyog.

nota: estoy usando wamp server

gracias, espero sus prontas respuestas.

esta es la informacion que tiene el .txt
17345123;Alejandra María; Martinez Cerón;Cra. 4 #23-7;O+;experta en C#
18222743;Ana Luisa;Gomez Pascal;Calle 7 #12ª-45;A-;telecomunicaciones


esto es lo que llevo de codigo.


<html>
<head>
<title>Segundo parcial </title>
</head>
<body>
<h1>Subir archivos mediante PHP</h1>
<form action="inicio.php" method=post enctype="multipart/form-data">
Ingrese aqui su archivo:<br><br>
<input type="file" name="archivo">
<input type="submit" value="Abrir">
</form>
<?php
@$archivo = $_FILES ['archivo'];
$nombrefile = $_FILES['archivo']['name'];
$rutatmp = $_FILES['archivo']['tmp_name'];

if(is_uploaded_file($rutatmp)) {


$filas = file('text.txt');
foreach($filas as $value){
list($ID, $NOM, $APP, $RES, $GS, $OBS) = explode(";", $value);

echo "<input type=\"TEXT\" name=\"cedula\" value=\"".$ID."\">";
echo "<input type=\"TEXT\" name=\"nombre\" value=\"".$NOM."\">";
echo "<input type=\"TEXT\" name=\"apellido\" value=\"".$APP."\">";
echo "<input type=\"TEXT\" name=\"residencia\" value=\"".$RES."\">";
echo "<input type=\"TEXT\" name=\"tiposangre\" value=\"".$GS."\">";
echo "<input type=\"TEXT\" name=\"observacion\" value=\"".$OBS."\">";
}

return true;
}
else
{ return false;}






?>


</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder