<?php
include("dbconfig.php");
$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"];
}
}
?>
<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" />
<!--
<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>
<!--
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();
?>