Hola a todo, tengo el siguiente porblema: Estoy intentando poder actualizar todos los campos de una tabla a la vez pero solo me funciona cuando en los campos introduzco numeros si pongo letras se quedan igual y no tengo ni idea de por que pasa eso os adjunto el codigo a ver si podeis ayudarme
 
 
<head>
  <title>Modificar</title>
  <head> 
<meta http-equiv="refresh" content="1; url=b.php">
</head>  
 
</head>
<body>
<h1>Datos Modificados Corectamente</h1>
 
  <?php
 
  $Ref=$_POST['Ref'];
  $Nombre=$_POST['Nombre'];
  $Primer_Apellido=$_POST['Primer_Apellido'];
  $Segundo_Apellido=$_POST['Segundo_Apellido'];
  $Telefono_Fijo=$_POST['Telefono_Fijo'];
  $Telefono_Movil=$_POST['Telefono_Movil'];
  for ($i=0;$i<count($Ref);$i++)    
{     
 $link = mysql_connect(localhost, root) or die(mysql_error($link));
  mysql_select_db(altorreal, $link) or die(mysql_error($link));
 
  $sql = "UPDATE vecinos SET Nombre =".$Nombre[$i].", Primer_Apellido=".$Primer_Apellido[$i].", Segundo_Apellido=".$Segundo_Apellido[$i]." ,Telefono_Fijo=".$Telefono_Fijo[$i]. ", Telefono_Movil=".$Telefono_Movil[$i]." WHERE Ref=".$Ref[$i];
      mysql_query($sql, $link) or die(mysql_error($link));
	 }  
  exit();
?>
 
 
 
 
 
</body>
</html>
 
 
 
 
<body>
<h1><center>Modificar Adaptadores </center></h1>
<?php
mysql_connect("localhost", "root") or
    die("Could not connect: " . mysql_error());
mysql_select_db("altorreal");
 
$result = mysql_query("SELECT Ref, Nombre, Primer_Apellido, Segundo_Apellido, Telefono_Fijo, Telefono_Movil  FROM vecinos");
echo "<form name= modificar method=post action=a.php>";
echo "<table><tr><td></td>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
 
     print '<INPUT TYPE="HIDDEN" NAME="Ref[]" VALUE='.$row["Ref"].'>';
	 print '<tr><td> Ref '.$row["Ref"].'</td>';
	 print '<td> Nombre <input type ="text" name="Nombre[]" value='.$row["Nombre"].'></td>';
	 print '<td> Primer_Apellido <input type ="text" name="Primer_Apellido[]" value='.$row["Primer_Apellido"].'></td>';
	 print '<td> Segundo_Apellido <input type ="text" name="Segundo_Apellido[]" value='.$row["Segundo_Apellido"].'></td>';
	 print '<td> Telefono_Fijo <input type ="text" name="Telefono_Fijo[]" value='.$row["Telefono_Fijo"].'></td>';
	 print '<td> Telefono_Movil <input type ="text" name="Telefono_Movil[]" value='.$row["Telefono_Movil"].'></td></tr>';
 
}
 
mysql_free_result($result);
echo "</table>";
echo "<h1><center><input type='submit' value='Modificar'><center></h1>";
 
 
?> 
 
 
</body>
</html>
 
Gracias 
   
 


 Este tema le ha gustado a 1 personas
Este tema le ha gustado a 1 personas