开发者

How to display poll results in jQuery?

开发者 https://www.devze.com 2023-02-16 06:37 出处:网络
I have the PHP/MySQL done for a polling system. It pretty simple, basically the db looks like this: idcityvote_count

I have the PHP/MySQL done for a polling system. It pretty simple, basically the db looks like this:

id  city            vote_count
-----------------------------------

1       Los Angelos       0
2       San Francisco     3

And this is the PHP:

    $city = $_GET['city'];
    $query = mysql_query(" UPDATE votes SET vote_count = vote_count + 1 WHERE city = '$city' ");
    echo ($query) ? 'success' : 'error';

So instead of showing a boring set of results like this:

Votes for 开发者_开发问答Los Angelos:       0
Votes for San Francisco      3

I rather show a fancy horizontal bar graph along with the boring numbers. Are there any plugins you can recommend for this?


Here you can find some jQuery plugins for graphs:

http://plugins.jquery.com/project/horiz-bar-graph

http://www.reynoldsftw.com/2009/02/6-jquery-chart-plugins-reviewed/

http://www.jqplot.com/tests/coretests.php


Perhaps this is what you want. It explains how to make bar graphs using jquery and jquery-ui.

0

精彩评论

暂无评论...
验证码 换一张
取 消