jquery - Fill progress bar with php value -


i make progress bar link :

http://www.metallicabyrequest.com/results.php?s=70

and have table 3 columns , progress bar should fill value third column :

http://jsfiddle.net/metcastle/ensr2/

        <table>             <thead>                 <tr>                     <th>song name</th>                     <th>% ballots w/ song</th>                     <th># votes</th>                 </tr>             </thead>             <?php foreach($array $element) { ?>             <tr>                 <td class="name"><?php echo $element['name']; ?></td>                 <td>progress bar 3 td value percent</td>                 <td><?php echo $element['votes']; ?></td>             </tr>             <?php } ?>         </table> 

hope can understand try say, !

if have number of total votes ($totalvotes) work with, , votes particular element ($element['votes']) use following:

        <tr>             <td class="name"><?php echo $element['name']; ?></td>             <td>               <div style="background-color:#000;color:#fff;width:<?php echo ($element['votes']/$totalvotes)*100; ?>%">                   <?php echo floor(($element['votes']/$totalvotes)*100); ?>%               </div>             </td>             <td><?php echo $element['votes']; ?></td>         </tr> 

though seems still need provide data (sql or otherwise) provide both total ballots, , total ballots element don't think want generate percentage based on votes "this" ballot can see. may end gathering separate ballot data ($totalballots , $ballotswiththiselement) proper percentage.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -