Location: PHPKode > projects > Uniweb > Uniweb/vpatronselect.php
<?
	$sql_vpas = "SELECT * FROM votacion where id = '$naslov' "; 
	if (($result_vpas = mysql_query($sql_vpas)) === FALSE){ 
	echo "MySQL Error: ".mysql_error()." 
	\n"; 
	die(); 
	}

	$myrow = mysql_fetch_array($result_vpas);
		$title = $myrow[title];
		$kukiname = "vota";
		$kukiname .= $naslov;

	echo '
	<table align=center border="0" bgcolor="'.$row_conf['conf_color_fuerte'].'" width=50% cellpadding="3" cellspacing="1">
	';

	$sql_vpas = "SELECT * FROM votacion where id = '$naslov' ";
	if (($result_vpas = mysql_query($sql_vpas)) === FALSE){ 
	echo "MySQL Error: ".mysql_error()." 
	\n"; 
	die(); 
	}

	while ($myrow = mysql_fetch_array($result_vpas)){
		$myrow[title] = stripslashes($myrow[title]);
		echo '
		<tr bgcolor="'.$row_conf['conf_color_fuerte'].'"><td><span class="tit01"><b>'.$myrow[title].'</b></span></td></tr>
		';
	};

	// Total votos
	$sql2 = "SELECT number FROM vota WHERE title='$naslov' ORDER BY number DESC"; 
	if (($result2 = mysql_query($sql2)) === FALSE){ 
	echo "MySQL Error: ".mysql_error()." 
	\n"; 
	die(); 
	}
	
	$all = "0";
	
	while ($myrow = mysql_fetch_array($result2)){
		$all = $all + $myrow[number];
	};
	
	
	// votos de cada opcion
	$sql2 = "SELECT * FROM vota WHERE title='$naslov' ORDER BY number DESC"; 
	if (($result2 = mysql_query($sql2)) === FALSE){ 
	echo "MySQL Error: ".mysql_error()." 
	\n"; 
	die(); 
	}
	echo '
	<tr bgcolor="'.$row_conf['conf_color_claro'].'"><td>
	<table  border="0" bgcolor="#FFFFFF" width=100% cellpadding="1" cellspacing="0">
	';
	
	while ($myrow = mysql_fetch_array($result2)){

		if ($all != "" OR "0") {
			$number = $myrow[number] / $all;
		};
	
		$number = substr($number, 0, 5);

		$number = $number * 100;
		$number2 = 100 - $number;
	
		$myrow[content] = stripslashes($myrow[content]);	
		echo '
		<tr bgcolor="'.$row_conf['conf_color_claro'].'"><td>
		<span class="texto01"><b>'.$myrow[content].'</b><br>
		<img src="imagenes/image1.gif" width="'.$number.'" height="10"><img src="imagenes/image2.gif" width="'.$number2.'" height="10"><br>
		'.$number.'% - '.$myrow[number].' votos</span>
		</td></tr>
		';
	};
	
	
	echo '
	
	<tr bgcolor="'.$row_conf['conf_color_claro'].'"><td><span class="texto01">Votos Totales: '.$all.'</span></td></tr>
	</table></td></tr>
	</table>
	';
//};
//PREPARAMOS LOS LINKS
	$sql_vpas = "SELECT * FROM votacion order by id DESC";
	$result_vpas = mysql_query($sql_vpas);
	$myrow = mysql_fetch_array($result_vpas);

		$top = $myrow['id']+1;
		$ant = $naslov-1;
		$sig = $naslov+1;

	
	echo '<table align=center width="50%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div align=left><font face="Arial, Helvetica, sans-serif" size="1" color="#CCCCCC">';
	if ($ant==0){
	echo '<< Anterior</fon></div></td>';
	}else{
		echo '<a href="index.php?dcha=vpasado.php&muestra=on&naslov='.$ant.'"><< Anterior</a></fon></div></td>';
	}
	echo '
    <td><div align=center><a href="index.php?dcha=vpasado.php">[Indice]</a></div></td>
    <td><div align=right><font face="Arial, Helvetica, sans-serif" size="1" color="#CCCCCC">';
	if ($sig==$top){
		echo 'Siguiente >></fon></div></td>';
	}else{
		echo '<a href="index.php?dcha=vpasado.php&muestra=on&naslov='.$sig.'">Siguiente >></a></fon></div></td>';
	}
	echo '
  </tr>
</table>';
?>
Return current item: Uniweb