|
|
|
เลือกข้อมูลแล้วกราฟไม่เปลี่ยนค่ะ jpgraph - php select list |
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Report For APC</title>
</head>
<body>
<p><img src="wallpaper3.jpg" width="1024" height="211" />
</p>
<p>
<?php
mysql_connect("localhost","root","1234") or die(mysql_error());
mysql_select_db("apcreport");
mysql_query("SET NAMES UTF8");
$sql = "SELECT salecode,groupcode,SUM(NetAmount) AS sumprice FROM bcarinvoicesub WHERE groupcode='".$_REQUEST['lmName1']."' GROUP BY salecode,groupcode";
$result = mysql_query($sql);
?>
<form action="phpmydream.php" method="post" name="form1">
รายการสินค้า<br>
<select name="lmName1">
<option value=""><-- กรุณาเลือกสินค้า --></option>
<?php
//session_start();
$strSQL = "SELECT * FROM bcitemgroup1";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["Code"];?>"><?=$objResuut["Code"]." - ".$objResuut["Name"];?></option>
<?php
}
?>
</select>
<input name="btnSubmit" type="submit" value="Submit"><br><br>
</form>
<?php
//include("../JpGraph/src/jpgraph.php");
//include("../JpGraph/src/jpgraph_pie.php");
require_once ('../JpGraph/src/jpgraph.php');
require_once ('../JpGraph/src/jpgraph_pie.php');
// include ("../jpgraph/src/jpgraph_bar.php");
$graph = new PieGraph(500,500);
$title = iconv("tis-620","utf-8","สถิติการขายสินค้า ");
$graph->title->set($title);
//$graph->title->setFont(FF_TAHOMA, FS_BOLD, 16);
$legends = array();
$data_graph = array();
while($data = mysql_fetch_array($result)){
$lg=iconv("tis-620","utf-8",$data['salecode']);
array_push($legends, $lg);
array_push($data_graph,$data['sumprice']);
}
$pie = new PiePlot($data_graph);
$pie->SetLegends($legends);
$graph->Add($pie);
//$graph->Stroke();
// Get the handler to prevent the library from sending the
// image to the browser
if (file_exists("phpmydream.png"))
unlink("phpmydream.png");
$gdImgHandler = $graph->Stroke(_IMG_AUTO);
// Stroke image to a file and browser
// Default is PNG so use ".png" as suffix
//$fileName = "../imagefile.png";
//$graph->img->Stream($fileName);
// Send it back to browser
//$graph->img->Headers();
//$graph->img->Stream();
// <img src="jpgraph/call_graph.php" />
?>
<img src="phpmydream.png" />
</p>
</body>
</html>
เลือกข้อมูลใน select list แล้วนำมาแสดงกราฟ แต่พอเลือกแล้ว ข้อมูลไม่เปลี่ยน
Tag : PHP, MySQL
|
ประวัติการแก้ไข 2011-09-29 11:48:23
|
|
|
|
|
Date :
2011-09-29 11:47:43 |
By :
confusion |
View :
1123 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ก็ที่แสดงมามันเป็นรูปเลยนี่ครับ หรือผมเข้าใจผิด
<img src="phpmydream.png" />
|
|
|
|
|
Date :
2011-09-29 12:53:37 |
By :
grandraftz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|