Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to show a chart of mysql data, with a update data feature.
Any one having knowledge about this pls let me know,

help will be greatly appreciated.

Thanks in Advance
Posted

 
Share this answer
 
Comments
[no name] 31-Jul-12 4:43am    
Thanks Tadit dash
but i already checks these link but there is no database used.
PHP
<?php
    include("dbconfig.php");
    //include("mysqldbconfig.php");
//get data from database

$sql="select sum(q1) as Total from rateourservice_data where rate_id between 1 and 5" ;
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if ($result) {
  while ($row = mysql_fetch_assoc($result)) {
      $totlapoll=$row["Total"];

        }
}
 // echo "Totla Poll Till Date =".$totlapoll;


?>


HTML
<script type="text/javascript" src="js/jquery.min.js"></script>
 
<style >
    .backdrop1
        {
            position:absolute;
            top:0px;
            left:0px;
            width:100%;
            height:100%;
            background:#000;
            opacity: .0;
            filter:alpha(opacity=0);
            z-index:50;
            display:none;
        }


        .box1
        {
            position:absolute;
            top:40%;
            left:20%;
            width:800px;
            height:250px;
            background:#ffffff;
            z-index:51;
            padding:10px;
            -webkit-border-radius: 5px;
            -moz-border-radius: 5px;
            border-radius: 5px;
            -moz-box-shadow:0px 0px 5px #444444;
            -webkit-box-shadow:0px 0px 5px #444444;
            box-shadow:0px 0px 5px #444444;
            display:none;
        }

        .close1
        {
            float:right;
            margin-right:6px;
            cursor:pointer;
        }
<script type="text/javascript">
		
			$(document).ready(function(){
			
				$('.q1').click(function(){
					$('.backdrop1, .box1').animate({'opacity':'.50'}, 300, 'linear');
					$('.box1').animate({'opacity':'1.00'}, 300, 'linear');
					$('.backdrop1, .box1').css('display', 'block');
				});
				
  $("#ok1").click(function () {
   close_box1();
  });


function hide1(){
close_box1();
}
$("#hide1").click(hide1);
				$('.close1').click(function(){
					close_box1();
				});
				
				$('.backdrop1').click(function(){
					close_box1();
				});
			
			

			});
			
			function close_box1()
			{
				$('.backdrop1, .box1').animate({'opacity':'0'}, 300, 'linear', function(){
					$('.backdrop1, .box1').css('display', 'none');
				});
			}
		
		</script>

<img src="rateourservicegraph/rateourserviceg1.php" title="When I first contacted Paper Bind they dealt with my enquiry quickly efficiently and promptly?" id="q1" name="q1" class="q1" />

 <!--graph-->
      <div class="backdrop1"></div>
     <div class="box1" style="overflow:scroll;"><div class="close1">x</div>
<span id="test1">Q1: When I first contacted Paper Bind they dealt with my enquiry quickly efficiently and promptly?!<br />
     <input type="button" id="ok1" name="ok1" value="Ok"/>
      <input type="button" id="hide1" name="hide1" value="Cancel"/></span>
<div id="result_table1">
</div></div>
<!--graph-->


rateourservice1.php
<pre lang="PHP">
include("phpgraphlib.php");
$graph=new PHPGraphLib(550,350);

$link = mysql_connect('localhost', 'root', 'cricket')
   or die('Could not connect: ' . mysql_error());
     
mysql_select_db('my_db') or die('Could not select database');
  
$dataArray=array();
  
 
//get data from database

$sql="SELECT sum(q1) as sales1,ans1 FROM rateourservice_data where rate_id between 1 and 5 group by ans1 " ;
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if ($result) {
  while ($row = mysql_fetch_assoc($result)) {
      $salesgroup=$row["ans1"];
      $count=$row["sales1"];
	
      //add to data areray
      $dataArray[$salesgroup]=$count;
  }
}
  
//configure graph
$graph->addData($dataArray);

$graph->setTitle("When I first contacted they dealt with my enquiry quickly efficiently and promptly?");
$graph->setGradient("lime", "green");
$graph->setBarOutlineColor("black");
$graph->createGraph();

?>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900