Hello, its me again with simple problem…
In my last topic i had problem because my mysql wasnt updated but with daveismyname’s help i solved my problem.
When i tried to display its something like this http://img163.imageshack.us/img163/895/77ee17f9a5074712ba3bb89.png
Problem is because the procentage go up, also the error Up is ‘The server wasnt send any informations and on bottom i want show old resultats’
Code looks like this
[php]$query = “SELECT SUM(Glasaci) FROM glasanje”;
$result = mysql_query($query);
$a = mysql_fetch_array($result);
$a[‘SUM(Glasaci)’];[/php]
This get the sum of all votes…
[php]function zemi_procent($broj,$od)
{
$procent = round($broj * 100 / $od);
echo $procent;
}[/php]
toa get procentage
and
[php]$rezultat = mysql_query(“SELECT * FROM glasanje”);
while($row = mysql_fetch_array($rezultat))
{
echo “
”.$row[‘Ime’]."
".zemi_procent($row[‘Glasaci’], $a[‘SUM(Glasaci)’])."% -".$row[‘Glasaci’]." Гласачи";}
}[/php]
the result of mysql . $row[‘Ime’] the name , .$row[‘Glasaci’] means votes from one like(prekrasno or super) and the sum