What I want to achieve:
So essentially when I upvote a client the green bar will increase and when I down vote the red bar increases.
I currently have it working so that when you up or down vote it submits a value to the database in 2 different columns: Positive and Negative. In the picture where the bars are, I currently have empty divs.
So how do I expand the div's based on the number of votes?
My clients.php:
<?php
$clientInfo = "SELECT * FROM Clients ORDER BY Client ASC";
$stmt = sqlsrv_query($conn, $clientInfo);
echo "<div style='width: 100%; display: inline-block;'>";
while ($client = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))
{
echo "<div class='clientid' style='height: 50px; font-size: 18px; vertical-align: middle; display: inline-block; width: 100%'>" .
"
<div style='width: 35%;'>
<div style='color: green;'></div>
</div>
<div style='display: inline-block; width: 5%;'>
<span style='font-size: 20px;' class='hover-cursor fa fa-chevron-up vote-up'></span>
</div>" .
"<div class='hover-cursor hvr-underline-reveal voteup votedown' data-clientid='{$client['ClientID']}' style='width: 20%; display: inline-block;'>" . $client['Client'] . "</div>" .
"<div style='display: inline-block; width: 5%;'>
<span style='font-size: 20px; text-align: right;' class='hover-cursor fa fa-chevron-down vote-down'></span>
</div>
<div style='width: 35%;'>
<div style='color: red;'></div>
</div>
</div>
<br />";
}
echo "</div>";
?>
Its the two divs with a width of 35% that will be the progress bars.
The columns should show based on a percentage of the total votes, so say there are 4 votes, 3 up 1 down, it shows 75% green, 25% red.