Ver Mensaje Individual
  #24 (permalink)  
Antiguo 09/09/2010, 09:30
eke_ps
 
Fecha de Ingreso: septiembre-2010
Mensajes: 101
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: problemas con update

se siguen modificando todas



if(isset($_POST['modificar'])){
mysql_query("UPDATE tbl_encuestasp SET pregunta='".$_POST['pregunta'] ."' WHERE id=".$_POST['id']);
//mysql_query("UPDATE tbl_encuestasr set respuesta=".$_POST['respuesta'] ." where idpregunta=".$_POST['id']);
mysql_query("UPDATE tbl_encuestasr SET respuesta='".$_POST['modopcion1'] ."' WHERE idpregunta=".$_POST['id'])or die(mysql_error());
//mysql_query("UPDATE tbl_encuestasr set respuesta=".$_POST['modopcion1'] ." WHERE idpregunta=".$_POST['id']);


}















y te muestro el form de paso


Cita:
<?php if(isset($_GET['m'])){
$modificar=mysql_fetch_array(mysql_query("SELECT id,pregunta FROM tbl_encuestasp WHERE id=".$_GET['id']));
$modificaropciones=mysql_query("SELECT idpregunta,respuesta FROM tbl_encuestasr WHERE idpregunta=".$_GET['id']);
?>

<form id="Modificar" name="form1" method="POST" action="adminencuesta.php">
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
<table align="center" border="0">
<tr>
<td height="48"width="342">Modifica la pregunta:

<input name="pregunta" type="text" id="pregunta" value="<?php echo($modificar['pregunta']);?>" size="40" maxlength="51" align="left" />
<br /></td>
</tr>

<tr><td height="1" bgcolor="#000000"></td></tr>
<tr>
<td height="42">modifica la opcion 1:
<?php $data=mysql_fetch_assoc($modificaropciones);?>
<input name="modopcion1" type="text" id="opcion1" value="<?php echo($data['respuesta']);?>" size="30" maxlength="28" /></td>
</tr>
<tr><td height="1" bgcolor="#000000"></td></tr>
<tr>
<td height="42">modifica la opcion 2:
<?php $data=mysql_fetch_assoc($modificaropciones);?>
<input name="opcion2" type="text" id="opcion2" value="<?php echo($data['respuesta']);?>" size="30" maxlength="28"/></td>
</tr>
<tr><td height="1" bgcolor="#000000"></td></tr>
<tr>
<td height="49">modifica la opcion 3:
<?php $data=mysql_fetch_assoc($modificaropciones);?>
<input type="text" id="opcion3" name="opcion3"size="30" value="<?php echo($data['respuesta']);?>" maxlength="28"/></td>
</tr>
<tr><td height="1" bgcolor="#000000"></td></tr>
<tr>
<td height="43">modifica la opcion 4:
<?php /*if($data=mysql_fetch_assoc($modificarocpiones)){
$opcion4=$data['respuesta'];
}else{
$o="";
}*/?>
<?php $data=mysql_fetch_assoc($modificaropciones);?>
<input type="text" id="opcion4" name="opcion4" value="<?php echo($data['respuesta']);?>" size="30" maxlength="28"/></td>

</tr>
</table>
<input name="modificar" type="submit" id="modificar"value="modificar" onClick="MM_validateForm('pregunta','','R','opcion 1','','R','opcion2','','R');return document.MM_returnValue" />
</form>