RE: [PHP-ES] SUPER BUG

From: Date: Mon, 22 Oct 2001 18:00:27 +0000
Subject: RE: [PHP-ES] SUPER BUG
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-15070@lists.php.net to get a copy of this message
Hola, Ayudaría mucho si dijeras qué error te da. De todos modos, un nombre de variable debe empezar con letra o underscore, y tienes cuatro que empiezan con un número. Igual es eso. Xavier -----Original Message----- From: The Käiser . : HBZ:. [mailto:webmaster@hackingballz.com] Sent: lunes, 22 de octubre de 2001 18:32 To: lista@phpes.com Subject: [PHP-ES] SUPER BUG Importance: High 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... --------------------------------------------------------------------- Archivo On-line: http://www.phpes.com/ Manual PHP en español: http://www.php.net/manual/es/ Para dar de baja la suscripción, mande un mensaje a: lista-unsubscribe@phpes.com

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