|
|
|
เรื่องกราฟ jpgraph ครับ ตามรูปเลยยยย ช่วยทีนะครับ ไม่มีที่พึ่ง |
|
|
|
|
|
|
|
คือตอนนี้ผมทำได้เท่านี้อ่าครับ ดึงจาก database มาแสดงจุด บนกราฟ
|
|
|
|
|
Date :
2012-05-02 23:29:45 |
By :
kitithat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ประมานอย่างนี้เลยครับ ช่วยผมคิดทีครับ
|
|
|
|
|
Date :
2012-05-03 08:07:32 |
By :
kitithat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override คลาส ที่เรนเดอร์คับ เพิ่มข้อความเอาเอง ผมก็ไม่เคยใช้น่ะนะ
|
|
|
|
|
Date :
2012-05-03 09:40:52 |
By :
pjgunner.com |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอดูคำสั่งการ query จากฐานข้อมูลหน่อยได้ไหมครับ
|
|
|
|
|
Date :
2012-05-03 10:04:43 |
By :
บู้ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
class mysql {
private $DB_HOST = 'localhost';
private $DB_USER = 'root';
private $DB_PASS = 'root';
private $DB_NAME = 'db_disc';
public function __construct(){
$con = mysql_connect($this->DB_HOST,$this->DB_USER,$this->DB_PASS) or die(mysql_error());
mysql_select_db($this->DB_NAME) or die(mysql_error());
mysql_set_charset('utf8',$con);
}
public function SELECT(){
$strSQL = "select * from test1 order by sumd desc limit 0,1 ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$rowCount = mysql_num_rows($objQuery);
if($rowCount > 0)
{
while($data = mysql_fetch_array($objQuery))
{
$data3= $data['sumd'];
echo $data3;
}
}
// เตรียมข้อมุลที่จะแสดง เพื่อสร้างกราฟ
}
public function SELECTNAME(){
$strSQL = "select * from test1 order by id desc limit 0,1 ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$rowCount = mysql_num_rows($objQuery);
if($rowCount > 0)
{
while($data = mysql_fetch_array($objQuery))
{
$data1= $data['name']." ".$data['surname'];
echo $data1;
}
}
return $data1;
}
public function fetch(){
return mysql_fetch_array($this->result); //row['colum']
}
public function num_rows(){
return mysql_num_rows($this->result); //number
}
public function SELECT_COUNT($str){
$result = mysql_query("SELECT COUNT(*) FROM $str");
$row = mysql_fetch_arry($result);
$row[0];
}
public function INSERT(){
$sumd = $sumi = $sums = $sumc = 0;
if($_POST['1'] == "M1") $sumd++;
else if($_POST['1'] == "M2") $sumi++;
else if($_POST['1'] == "M3") $sumc++;
else $sums++;
if($_POST['2'] == "L1") $sumd--;
else if($_POST['2'] == "L2") $sumi--;
else if($_POST['2'] == "L3") $sumc--;
else $sums--;
if($_POST['3'] == "M21") $sumc++;
else if($_POST['3'] == "M22") $sumd++;
else if($_POST['3'] == "M23") $sums++;
else $sumi++;
if($_POST['4'] == "L21") $sumc--;
else if($_POST['4'] == "L22") $sumd--;
else if($_POST['4'] == "L23") $sums--;
else $sumi--;
if($_POST['5'] == "M31") $sumi++;
else if($_POST['5'] == "M32") $sumc++;
else if($_POST['5'] == "M33") $sumd++;
else $sums++;
if($_POST['6'] == "L31") $sumi--;
else if($_POST['6'] == "L32") $sumc--;
else if($_POST['6'] == "L33") $sumd--;
else $sums--;
if($_POST['7'] == "M41") $sumi++;
else if($_POST['7'] == "M42") $sumc++;
else if($_POST['7'] == "M43") $sums++;
else $sumd++;
if($_POST['8'] == "L41") $sumi--;
else if($_POST['8'] == "L42") $sumc--;
else if($_POST['8'] == "L43") $sums--;
else $sumd--;
if($_POST['9'] == "M51") $sumd++;
else if($_POST['9'] == "M52") $sumc++;
else if($_POST['9'] == "M53") $sumi++;
else $sums++;
if($_POST['10'] == "L51") $sumd--;
else if($_POST['10'] == "L52") $sumc--;
else if($_POST['10'] == "L53") $sumi--;
else $sums--;
if($_POST['11'] == "M61") $sumc++;
else if($_POST['11'] == "M62") $sumi++;
else if($_POST['11'] == "M63") $sums++;
else $sumd++;
if($_POST['12'] == "L61") $sumc--;
else if($_POST['12'] == "L62") $sumi--;
else if($_POST['12'] == "L63") $sums--;
else $sumd--;
if($_POST['13'] == "M71") $sumi++;
else if($_POST['13'] == "M72") $sumc++;
else if($_POST['13'] == "M73") $sumd++;
else $sums++;
if($_POST['14'] == "L71") $sumi--;
else if($_POST['14'] == "L72") $sumc--;
else if($_POST['14'] == "L73") $sumd--;
else $sums--;
if($_POST['15'] == "M81") $sums++;
else if($_POST['15'] == "M82") $sumi++;
else if($_POST['15'] == "M83") $sumc++;
else $sumd++;
if($_POST['16'] == "L81") $sums--;
else if($_POST['16'] == "L82") $sumi--;
else if($_POST['16'] == "L83") $sumc--;
else $sumd--;
if($_POST['17'] == "M91") $sumc++;
else if($_POST['17'] == "M92") $sums++;
else if($_POST['17'] == "M93") $sumi++;
else $sumd++;
if($_POST['18'] == "L91") $sumc--;
else if($_POST['18'] == "L92") $sums--;
else if($_POST['18'] == "L93") $sumi--;
else $sumd--;
if($_POST['19'] == "M101") $sumd++;
else if($_POST['19'] == "M102") $sumi++;
else if($_POST['19'] == "M103") $sums++;
else $sumc++;
if($_POST['20'] == "L101") $sumd--;
else if($_POST['20'] == "L102") $sumi--;
else if($_POST['20'] == "L103") $sums--;
else $sumc--;
if($_POST['21'] == "M111") $sums++;
else if($_POST['21'] == "M112") $sumc++;
else if($_POST['21'] == "M113") $sumd++;
else $sumi++;
if($_POST['22'] == "L111") $sums--;
else if($_POST['22'] == "L112") $sumc--;
else if($_POST['22'] == "L113") $sumd--;
else $sumi--;
if($_POST['23'] == "M121") $sumi++;
else if($_POST['23'] == "M122") $sumc++;
else if($_POST['23'] == "M123") $sums++;
else $sumd++;
if($_POST['24'] == "L121") $sumi--;
else if($_POST['24'] == "L122") $sumc--;
else if($_POST['24'] == "L123") $sums--;
else $sumd--;
if($_POST['25'] == "M131") $sumd++;
else if($_POST['25'] == "M132") $sums++;
else if($_POST['25'] == "M133") $sumi++;
else $sumc++;
if($_POST['26'] == "L131") $sumd--;
else if($_POST['26'] == "L132") $sums--;
else if($_POST['26'] == "L133") $sumi--;
else $sumc--;
if($_POST['27'] == "M141") $sumd++;
else if($_POST['27'] == "M142") $sums++;
else if($_POST['27'] == "M143") $sumc++;
else $sumi++;
if($_POST['28'] == "L141") $sumd--;
else if($_POST['28'] == "L142") $sums--;
else if($_POST['28'] == "L143") $sumc--;
else $sumi--;
if($_POST['29'] == "M151") $sumi++;
else if($_POST['29'] == "M152") $sumc++;
else if($_POST['29'] == "M153") $sumd++;
else $sums++;
if($_POST['30'] == "L151") $sumi--;
else if($_POST['30'] == "L152") $sumc--;
else if($_POST['30'] == "L153") $sumd--;
else $sums--;
if($_POST['31'] == "M161") $sums++;
else if($_POST['31'] == "M162") $sumd++;
else if($_POST['31'] == "M163") $sumc++;
else $sumi++;
if($_POST['32'] == "L161") $sums--;
else if($_POST['32'] == "L162") $sumd--;
else if($_POST['32'] == "L163") $sumc--;
else $sumi--;
if($_POST['33'] == "M171") $sumi++;
else if($_POST['33'] == "M172") $sums++;
else if($_POST['33'] == "M173") $sumd++;
else $sumc++;
if($_POST['34'] == "L171") $sumi--;
else if($_POST['34'] == "L172") $sums--;
else if($_POST['34'] == "L173") $sumd--;
else $sumc--;
if($_POST['35'] == "M181") $sums++;
else if($_POST['35'] == "M182") $sumd++;
else if($_POST['35'] == "M183") $sumc++;
else $sumi++;
if($_POST['36'] == "L181") $sums--;
else if($_POST['36'] == "L182") $sumd--;
else if($_POST['36'] == "L183") $sumc--;
else $sumi--;
if($_POST['37'] == "M191") $sumd++;
else if($_POST['37'] == "M192") $sumi++;
else if($_POST['37'] == "M193") $sums++;
else $sumc++;
if($_POST['38'] == "L191") $sumd--;
else if($_POST['38'] == "L192") $sumi--;
else if($_POST['38'] == "L193") $sums--;
else $sumc--;
if($_POST['39'] == "M201") $sumi++;
else if($_POST['39'] == "M202") $sums++;
else if($_POST['39'] == "M203") $sumd++;
else $sumc++;
if($_POST['40'] == "L201") $sumi--;
else if($_POST['40'] == "L202") $sums--;
else if($_POST['40'] == "L203") $sumd--;
else $sumc--;
if($_POST['41'] == "M211") $sumc++;
else if($_POST['41'] == "M212") $sums++;
else if($_POST['41'] == "M213") $sumi++;
else $sumd++;
if($_POST['42'] == "L211") $sumc--;
else if($_POST['42'] == "L212") $sums--;
else if($_POST['42'] == "L213") $sumi--;
else $sumd--;
if($_POST['43'] == "M221") $sumd++;
else if($_POST['43'] == "M222") $sums++;
else if($_POST['43'] == "M223") $sumc++;
else $sumi++;
if($_POST['44'] == "L221") $sumd--;
else if($_POST['44'] == "L222") $sums--;
else if($_POST['44'] == "L223") $sumc--;
else $sumi--;
if($_POST['45'] == "M231") $sumi++;
else if($_POST['45'] == "M232") $sumc++;
else if($_POST['45'] == "M233") $sumd++;
else $sums++;
if($_POST['46'] == "L231") $sumi--;
else if($_POST['46'] == "L232") $sumc--;
else if($_POST['46'] == "L233") $sumd--;
else $sums--;
if($_POST['47'] == "M241") $sumi++;
else if($_POST['47'] == "M242") $sumc++;
else if($_POST['47'] == "M243") $sumd++;
else $sums++;
if($_POST['48'] == "L241") $sumi--;
else if($_POST['48'] == "L242") $sumc--;
else if($_POST['48'] == "L243") $sumd--;
else $sums--;
if($_POST['49'] == "M251") $sumd++;
else if($_POST['49'] == "M252") $sumc++;
else if($_POST['49'] == "M253") $sums++;
else $sumi++;
if($_POST['50'] == "L251") $sumd--;
else if($_POST['50'] == "L252") $sumc--;
else if($_POST['50'] == "L253") $sums--;
else $sumi--;
if($_POST['51'] == "M261") $sumi++;
else if($_POST['51'] == "M262") $sumc++;
else if($_POST['51'] == "M263") $sumd++;
else $sums++;
if($_POST['52'] == "L261") $sumi--;
else if($_POST['52'] == "L262") $sumc--;
else if($_POST['52'] == "L263") $sumd--;
else $sums--;
if($_POST['53'] == "M271") $sumd++;
else if($_POST['53'] == "M272") $sums++;
else if($_POST['53'] == "M273") $sumi++;
else $sumc++;
if($_POST['54'] == "L271") $sumd--;
else if($_POST['54'] == "L272") $sums--;
else if($_POST['54'] == "L273") $sumi--;
else $sumc--;
if($_POST['55'] == "M281") $sumc++;
else if($_POST['55'] == "M282") $sumi++;
else if($_POST['55'] == "M283") $sums++;
else $sumd++;
if($_POST['56'] == "L281") $sumc--;
else if($_POST['56'] == "L282") $sumi--;
else if($_POST['56'] == "L283") $sums--;
else $sumd--;
$sql = " INSERT INTO `db_disc`.`test1` (`id`, `name`, `surname`, `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`,`sumd`,`sumi`,`sums`,`sumc`) VALUES (NULL,'{$_POST['name']}','{$_POST['surname']}','{$_POST['1']}','{$_POST['2']}',
'{$_POST['3']}','{$_POST['4']}','{$_POST['5']}','{$_POST['6']}','{$_POST['7']}','{$_POST['8']}','{$_POST['9']}','{$_POST['10']}',
'{$_POST['11']}','{$_POST['12']}','{$_POST['13']}','{$_POST['14']}','{$_POST['15']}','{$_POST['16']}','{$_POST['17']}','{$_POST['18']}',
'{$_POST['19']}','{$_POST['20']}','{$_POST['21']}','{$_POST['22']}','{$_POST['23']}','{$_POST['24']}','{$_POST['25']}','{$_POST['26']}',
'{$_POST['27']}','{$_POST['28']}','{$_POST['29']}','{$_POST['30']}','{$_POST['31']}','{$_POST['32']}','{$_POST['33']}','{$_POST['34']}',
'{$_POST['35']}','{$_POST['36']}','{$_POST['37']}','{$_POST['38']}','{$_POST['39']}','{$_POST['40']}','{$_POST['41']}','{$_POST['42']}',
'{$_POST['43']}','{$_POST['44']}','{$_POST['45']}','{$_POST['46']}','{$_POST['47']}','{$_POST['48']}','{$_POST['49']}','{$_POST['50']}',
'{$_POST['51']}','{$_POST['52']}','{$_POST['53']}','{$_POST['54']}','{$_POST['55']}','{$_POST['56']}','$sumd','$sumi','$sums','$sumc');";
mysql_query($sql);
mysql_close();
}
public function DELETE($str) {
return mysql_query("DELETE FROM $str");
}
public function UPDATE($str) {
return mysql_query("UPDATE $str");
}
public function error() {
return mysql_error();
}
}
?>
|
|
|
|
|
Date :
2012-05-03 10:32:20 |
By :
kitithat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|