|
|
|
jpgraph ช่วยหน่อยนะค่ไม่เป็นภาษาไทย ใช้ ฐานข้อมูล UFT 8 |
|
|
|
|
|
|
|
ขอคำอธิบายหน่อยค่ะ... iconv()ต้องไปใส่ตรงไหนค่ะ
|
|
|
|
|
Date :
2011-11-26 12:00:45 |
By :
jub |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
include("dbconn.inc.php");
if (!isset($_SESSION)) {
session_start();
}
$topic_id = $_GET['tid'];
$qid = $_GET['qid'];
$sql = "SELECT title, num_vote FROM topic WHERE topic_id = $topic_id;";
$result = mysql_query($sql);
$num_votes = mysql_result($result, 0, "num_vote");
if($num_votes == 0) {
die("<h2>�ѧ����ռ����ǵ��Ǣ���</h2>");
}
$sql = "select * from question where ques_id = $qid order by ques_id;";
$resultmain = mysql_query($sql);
while ($datamain = mysql_fetch_array($resultmain)) { // loop table question
$question = $datamain['ques_title'];
include("JpGraph/src/jpgraph.php");
include("JpGraph/src/jpgraph_pie.php");
$g = new PieGraph(500, 500);
$title = "ผลลัพธ์";
$g->title->Set($title);
$g->title->SetFont(FF_JASMINE, FS_BOLD, 18);
$topic = mysql_result($result, 0, "title");
$subtitle = $question;
$g->subtitle->Set($subtitle);
$g->subtitle->SetFont(FF_CORDIA, FS_NORMAL, 16);
$sql = "SELECT * FROM choice WHERE ques_id = $qid;";
$result = mysql_query($sql);
$legends = array();
$data_graph = array();
while($data = mysql_fetch_array($result)) {
$lg = $data['item'];
array_push($legends, $lg);
array_push($data_graph, $data['score']);
}
$pie = new PiePlot($data_graph);
$pie->SetLegends($legends);
$g->legend->SetFont(FF_CORDIA, FS_NORMAL, 12);
$g->Add($pie);
$g->Stroke();
?>
<? } ?>
โค้ด ค่ะ
|
|
|
|
|
Date :
2011-11-26 12:08:46 |
By :
jub |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$title = "ผลลัพธ์";
ครอบพวกตัวแปรครับ และค่าที่เป็นภาษาไทยครับ
|
|
|
|
|
Date :
2011-11-26 16:34:15 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|