Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/04/2005, 11:03
dancresi
 
Fecha de Ingreso: marzo-2005
Mensajes: 372
Antigüedad: 19 años, 1 mes
Puntos: 1
ayuda con php

hola amigos tngo este error Warning: Division by zero in c:\siee\www\encuesta1.php on line 20 alguien sabe por que o aue se deb este error, gracias por su ayuda me urge..


<?
include("conex_sie.php");
$link=Conectarse();

$opciones=array('Exelente','Bueno','Regular','Malo ');
if(isset($_GET["voto"]))
{
$ip=$REMOTE_ADDR;
$sql="INSERT INTO encuesta1 (ip,voto) VALUES ('$ip',".$_GET["voto"].")";
$votos=mysql_query($sql);
}
$i=0;
$sql2="SELECT count(ip) FROM encuesta1";
$total=mysql_result(mysql_query($sql2),0);
echo"<form><table border=0 cellpadding=0>\n";
while($opciones[$i])
{
$sql3="SELECT count(ip) FROM encuesta1 WHERE voto=$i";
$votos=mysql_result(mysql_query($sql3),0);
$porcentaje=round($votos/$total*100,2); //linea20
echo"<tr>\n";
echo"<td colspan=3><b>$opciones[$i]</b></td>\n";
echo"</tr>\n";
echo"<tr>\n";
echo" <td><input type=radio value=$i name=voto></td>\n";
echo"<td><hr color=#008000 size=10 width=$porcentaje aling=left>\n";
echo"</td>\n";
echo"<td aling=right>$porcentaje%($votos)</td>\n";
echo"</td>\n";
$i++;
}
echo"<tr>\n";
echo"<td colspan=3><bt><input type=submit value=Votar></td>\n";
echo"</table></form>";
?>