Ver Mensaje Individual
  #10 (permalink)  
Antiguo 01/09/2010, 14:18
jhos
 
Fecha de Ingreso: agosto-2010
Mensajes: 7
Antigüedad: 14 años, 6 meses
Puntos: 0
Respuesta: Modificar un registro txt

echo "Ingrese el numero de cedula: \n";
$cedu = trim (fgets(STDIN));
$archivo = file("dataClientes.txt");
$lineas = count($archivo);
for($i=0; $i <= $lineas; $i++)
{
$clientes[] = explode(";",$archivo[$i]);
}
for($i=0; $i<=count($clientes); $i++)
{
if($cedu == $clientes[$i][0])
{
printf("%-10s%-30s%-30s%-30s\n",$clientes[$i][0],$clientes[$i][1],$clientes[$i][2],$clientes[$i][3]);
echo "¿Seguro que desea modificar este registro?si/no \n";
$resp = trim (fgets(STDIN));
switch ($resp)
{
case $resp=='si':
echo "Ingrese Cedula: \n";
$ced = trim (fgets(STDIN));
echo "Ingrese Nombre: \n";
$nom = trim (fgets(STDIN));
echo "Ingrese Apellido: \n";
$ape = trim (fgets(STDIN));
echo "Ingrese Observaciones: \n";
$obs = trim (fgets(STDIN));
$clientes[0]=$ced;
$clientes[1]=$nom;
$clientes[2]=$ape;
$clientes[3]=$obs;
$clientes[$i]=implode(";", $clientes);
}
}
}

Asi lo hice con el implode como me recomendaste y no funciono..