Ver Mensaje Individual
  #18 (permalink)  
Antiguo 16/08/2009, 15:48
only_skating
 
Fecha de Ingreso: agosto-2008
Mensajes: 382
Antigüedad: 15 años, 8 meses
Puntos: 2
Respuesta: encuesta simple con mysql

Código PHP:
<?
include('../pages/conexion.php');

$texto=$_POST["participante"];

$consulta mysql_query("SELECT texto FROM respuestas WHERE texto='$texto'") or die(mysql_error());
$recuento mysql_num_rows($consulta);
while(
$row mysql_fetch_array($consulta)){ 
        
$votos$row['votos'];
    }

$votos $votos 1;

$consulta "UPDATE respuestas SET votos = $votos WHERE texto='$texto'";
mysql_query($consulta) or die(mysql_error());

print 
"conseguido!"


?>

y el formulario

<body>
<form action="votar1.php" method="post">
<input name="participante" type="hidden" value="kalimero" />
<input name="votar" type="submit" value="Enviar" />
</form>
</body>
</html>