SUPER BUG

From: Date: Mon, 22 Oct 2001 16:31:43 +0000
Subject: SUPER BUG
References: 1 2 3 4 5 6  Groups: php.general.es 
Request: Send a blank email to general-es+get-15067@lists.php.net to get a copy of this message
SUPER BUG -- Hola gente, es que no consigo que este script me funcione les agradeceria me ayuden con el... results.php <?php $BD = "poll"; mysql_connect("localhost", "admin", "xxxx"); if (isset($Answer)) { $query = "UPDATE spoll SET votes=votes+1 WHERE answer_id = $Answer;"; $result = mysql_db_query($BD, $query); } $query = "SELECT votes from samplepoll"; $result = (mysql_db_query($BD, $query)); $row = mysql_fetch_array($result); $votes_1 = $row["votes"]; $row = mysql_fetch_array($result); $votes_2 = $row["votes"]; $row = mysql_fetch_array($result); $votes_3 = $row["votes"]; $row = mysql_fetch_array($result); $votes_4 = $row["votes"]; $votes_all = $votes_1 + $votes_2 + $votos_3 + $votos_4; if ($votes_all == 0) { $1_percent = 0; $2_percent = 0; $3_percent = 0; $4_percent = 0; } else { $1_percent = (int) ($votes_1*100/$votes_all); $2_percent = (int) ($votes_2*100/$votes_all); $3_percent = (int) ($votes_3*100/$votes_all); $4_percent = (int) ($votes_4*100/$votes_all); } echo "¡Esta SOLO!: $votes_1<br> <img src=bar.gif width=$1_percent height=10> $1_percent% <br>"; echo "Bonito...: $votes_2<br> <img src=bar.gif width=$2_percent height=10> $2_percent% <br>"; echo "Más o Menos.: $votes_3<br> <img src=bar.gif width=$3_percent height=10> $3_percent% <br>"; echo "HORRIBLE: $votes_4<br> <img src=bar.gif width=$4_percent height=10> $4_percent%<br> "; ?> SQL CREATE table spoll(answer_id INT, votes INT); INSERT into spoll VALUES(1, 0); INSERT into spoll VALUES(2, 0); INSERT into spoll VALUES(3, 0); INSERT into spoll VALUES(4, 0); -- Les agradeceria me digan en que estoy mal...

« previous php.general.es (#15067) next »