Advertisement

03.24.2008 at 01:35PM PDT, ID: 23265243
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

create a graph with figures retrieved from a query ..

Asked by memberfromuk in PHP Scripting Language, Databases Miscellaneous, PHP and Databases

Tags: , ,

Hi,
I have downloaded PHP/SWF 4.6 charts from   http://www.maani.us/charts/index.php?menu=Download

i get absolutely confused when attempting to create a graph from the records retrieved from my queries which you can see below in the snippet.

Can anyone help me to get this code working please or recommend a better option please please? a simple pie chart or bar graph is ok.

Thanks all.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
<?php
	session_start();
	if (isset($_SESSION['username']) == false){
		header("Location:login.php");
		exit();
	}
	require "connect.php";
	
	
	$customer_ref = $_GET['customer_ref'];
	$policy_ref = $_GET['policy_ref'];
	$risk_address_ref = $_GET['risk_address_ref'];
 
	
	$query = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref";
	
	$queryjan = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-01-01' and '2008-02-01'";
	//could use CURRENT YEAR function to update Years automatically YEAR()
	
	$queryfeb = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-02-01' and '2008-03-01'";
	
	$querymar = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-03-01' and '2008-04-01'";
	
	$queryapr = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-04-01' and '2008-05-01'";
	
	$querymay = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-05-01' and '2008-06-01'";
	
	$queryjun = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-06-01' and '2008-07-01'";
	
	$queryjul = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-07-01' and '2008-08-01'";
	
	$queryaug = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-08-01' and '2008-09-01'";
	
	$querysep = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-09-01' and '2008-10-01'";
	
	$queryoct = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-10-01' and '2008-11-01'";
	
	
	$querynov = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-11-01' and '2008-12-01'";
	
	$querydec = "SELECT SUM(i.commission * p.premium) AS total FROM insurer i, policy p WHERE i.insurer_ref = p.insurer_ref and p.cover_start_date BETWEEN '2008-12-01' and '2009-01-01'";
	
$result = mysql_query($query, $connection)
or die ("MySQL Error1: ".mysql_error());
$row = mysql_fetch_array($result);
 
$resultjan = mysql_query($queryjan, $connection)
or die ("MySQL ErrorJan: ".mysql_error());
$row1 = mysql_fetch_array($resultjan);
 
$resultfeb = mysql_query($queryfeb, $connection)
or die ("MySQL ErrorFeb: ".mysql_error());
$row2 = mysql_fetch_array($resultfeb);
 
$resultmar = mysql_query($querymar, $connection)
or die ("MySQL ErrorMar: ".mysql_error());
$row3 = mysql_fetch_array($resultmar);
 
$resultapr = mysql_query($queryapr, $connection)
or die ("MySQL ErrorApr: ".mysql_error());
$row4 = mysql_fetch_array($resultapr);
 
$resultmay = mysql_query($querymay, $connection)
or die ("MySQL ErrorMay: ".mysql_error());
$row5 = mysql_fetch_array($resultmay);
 
$resultjun = mysql_query($queryjun, $connection)
or die ("MySQL ErrorJun: ".mysql_error());
$row6 = mysql_fetch_array($resultjun);
 
$resultjul = mysql_query($queryjul, $connection)
or die ("MySQL ErrorJul: ".mysql_error());
$row7 = mysql_fetch_array($resultjul);
 
$resultaug = mysql_query($queryaug, $connection)
or die ("MySQL ErrorAug: ".mysql_error());
$row8 = mysql_fetch_array($resultaug);
 
$resultsep = mysql_query($querysep, $connection)
or die ("MySQL ErrorSep: ".mysql_error());
$row9 = mysql_fetch_array($resultsep);
 
$resultoct = mysql_query($queryoct, $connection)
or die ("MySQL ErrorOct: ".mysql_error());
$row10 = mysql_fetch_array($resultoct);
 
$resultnov = mysql_query($querynov, $connection)
or die ("MySQL ErrorNov: ".mysql_error());
$row11 = mysql_fetch_array($resultnov);
 
$resultdec = mysql_query($querydec, $connection)
or die ("MySQL ErrorDec: ".mysql_error());
$row12 = mysql_fetch_array($resultdec);
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GSS - Add Risk Address</title>
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {color: #0000CC}
.style2 {
	color: #000000;
	font-weight: bold;
}
.style3 {color: #000000}
-->
</style>
</head>
<body>
<div id="header">
	<ul id="menu">
		<li><a href="home.php">Home</a></li>
		<li><a href="search_customer.php" accesskey="2" title="">Customers</a></li>
		<li><a href="reports.php" accesskey="3" title="">reports</a></li>
		<li><a href="search_policy" accesskey="4" title="">document management</a></li>
		<li><a href="emailform.php" accesskey="5" title="">email</a></li>
	</ul>
</div>
<div id="content">
	<div id="colOne">
		<div id="logo">
			<h1><a href="#">gss</a></h1>
			<h2>insurance and property services </h2>
		</div>
		<div class="box">
		  <ul class="bottom"><li></li>
		  </ul>
	  </div>
		<div class="box">
		  <h3><a href="account07.php">2007</a></h3>
		  <h3><a href="account06.php">2006</a></h3>
		  <h3><a href="account05.php">2005</a></h3>
		  <h3><a href="account04.php">2004</a></h3>
		  <h3><a href="account03.php">2003</a></h3>
			<ul class="bottom"><li></li>
			</ul>
	  </div>
	</div>
	<div id="colTwo">
		<h2>2008</h2>
		<p class="indent">
	
<h1 align="center">Total Revenue </h1>
 
 
</p>
<div class="box">
			<h3></h3>
			
			<table width="200" border="1">
  <tr>
    <th scope="col"><span class="style2">January</span></th>
    <th scope="col"><span class="style2">February</span></th>
    <th scope="col"><span class="style3">March</span></th>
    <th scope="col"><span class="style3">April</span></th>
    <th scope="col"><span class="style3">May</span></th>
    <th scope="col"><span class="style3">June</span></th>
    <th scope="col"><span class="style3">July</span></th>
    <th scope="col"><span class="style3">August</span></th>
    <th scope="col"><span class="style3">September</span></th>
    <th scope="col"><span class="style3">November</span></th>
    <th scope="col"><span class="style3">December</span></th>
    <th scope="col"><span class="style3">Total</span></th>
  </tr>
  <tr>
    <th scope="row"><span class="style1"><?php echo $row1['total'];?></span></th>
    <td><span class="style1"><?php echo $row2['total'];?></span></td>
    <td><span class="style1"><?php echo $row3['total'];?></span></td>
    <td><span class="style1"><?php echo $row4['total'];?></span></td>
    <td><span class="style1"><?php echo $row5['total'];?></span></td>
    <td><span class="style1"><?php echo $row6['total'];?></span></td>
    <td><span class="style1"><?php echo $row7['total'];?></span></td>
    <td><span class="style1"><?php echo $row8['total'];?></span></td>
    <td><span class="style1"><?php echo $row9['total'];?></span></td>
    <td><span class="style1"><?php echo $row10['total'];?></span></td>
    <td><span class="style1"><?php echo $row11['total'];?></span></td>
    <td><span class="style1"><?php echo $row12['total'];?></span></td>
  </tr>
</table>
 
 
 
			<h4>Total:	<?php  echo $row['total'];?></h4>
			
			<h4></h4>
			<p class="bottom">&nbsp;</p>
	  </div>
  </div>
</div>
<div id="footer">
	<p>Copyright (c) 2008 Joe Tzouvanni All rights reserved.</p>
</div>
</body>
</html>
[+][-]03.24.2008 at 09:04PM PDT, ID: 21199423

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.25.2008 at 05:29AM PDT, ID: 21201194

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.25.2008 at 09:02AM PDT, ID: 21203157

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, Databases Miscellaneous, PHP and Databases
Tags: php/MySQL, Dreamweaver 8, php 5.2.5 MySQL 5.0.45
Sign Up Now!
Solution Provided By: logudotcom
Participating Experts: 1
Solution Grade: B
 
 
[+][-]03.25.2008 at 09:02AM PDT, ID: 21203163

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.25.2008 at 10:18AM PDT, ID: 21203938

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628