Ver Mensaje Individual
  #6 (permalink)  
Antiguo 24/01/2010, 10:52
pilucho
 
Fecha de Ingreso: noviembre-2004
Ubicación: NULL
Mensajes: 655
Antigüedad: 19 años, 5 meses
Puntos: 6
Respuesta: Problema UPDATE y PHP (Misterioso error)

Prueba asi


Código PHP:


<?
if (isset($_POST['action']) && $_POST['action'] == 'edit')
{
    
$red1 = (int)$_POST['red1'];
    
$sql="UPDATE clanprueba SET red1 ='$red1' WHERE username = '$username'"
    
mysql_query($sql); 

}

//MUESTRO LOS DATOS 
$resultado2 = @mysql_query ("SELECT * FROM clanprueba WHERE `username` = '$username'"); 

while (
$fila mysql_fetch_array($resultado2)) { 
echo 
$fila['red1']; 
}  

?>
<form action="editaroficiales.php" method="post">     
<?php 
$username
=$_SESSION['s_username']; 

 
$resultado2 = @mysql_query ("SELECT * FROM clanprueba WHERE `username` = '$username' "); 
    while (
$fila mysql_fetch_array($resultado2)) 
    { 
     
?> 

<input name="red1" type="text" value="<? echo $fila['red1']; ?>"><br /> 
<input type="hidden" name="action" value="edit">
<input name="submit" type="submit" value="Enviar"> 
</form>
Fijate en el campo del formulario:
<input type="hidden" name="action" value="edit">

copia el codigo y prueba y me avisas como te va