Hi, i was wondering, would anyone be able to help me add up the total votes here and put it underneath?
This will come out something like
Playstation 2 9
Playstation 7
Xbox 6
GameCube 8
Now how in php would you make it add up those results (9,7,6,8) and display them underneath like below??
I want to no how you get the total number of votes!
Playstation 2 9
Playstation 7
Xbox 6
GameCube 8
-------------------
Total votes: 30
Any ideas??
Thanx
Martin
Code:
<?php
include ("config1.php");
$conn = mysql_connect($host, $user, $pass);
mysql_select_db($db, $conn);
$query3 = mysql_query("SELECT * FROM poll ORDER by views DESC");
$currentrow =0;
while ($r = mysql_fetch_array($query3)) {
$c = $r["choise"];
$cl = $r["clink"];
$v= $r["views"];
$currentrow++;
if ($currentrow % 2 == 0) {
$color = "#CCCCCC";
} else {
$color = "#999999";
}
?>
<center>
<table width="140" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="96" height="19" valign="top" bgcolor="<?php echo("$color"); ?>">
<div align="center"><a href="<?php echo($cl); ?>"><?php echo($c); ?></a></div></td>
<td width="44" valign="top" bgcolor="<?php echo("$color"); ?>">
<div align="center"><?php echo($v); ?></div></td>
</tr>
</table>
</center>
<?php
}
?>
This will come out something like
Playstation 2 9
Playstation 7
Xbox 6
GameCube 8
Now how in php would you make it add up those results (9,7,6,8) and display them underneath like below??
I want to no how you get the total number of votes!
Playstation 2 9
Playstation 7
Xbox 6
GameCube 8
-------------------
Total votes: 30
Any ideas??
Thanx
Martin