<?php
include ("admin/jpgraph/src/jpgraph.php");
include ("admin/jpgraph/src/jpgraph_line.php");
include ('admin/module/connect.php');
//$strSQL = "SELECT * FROM tbl_spc";
if($_GET["dateStart"] and $_GET["dateStop"]!= ""){
$strSQL = "SELECT * FROM tbl_spc WHERE Date BETWEEN '".$_GET["dateStart"]."' AND '".$_GET["dateStop"]."'";
} else
$strSQL = "SELECT * FROM tbl_spc";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
// เตรียมข้อมุลที่จะแสดง เพื่อสร้างกราฟ
$datay=array();
while($objResult = mysql_fetch_array($objQuery))
{
$datay1[]= $objResult["Tilt"];
$datay2[]= $objResult["AvgG"];
$datay3[]= $objResult["Flatness"];
$datay4[]= $objResult["Noise"];
$datay5[]= $objResult["Date"];
}
หลังจากพยายามอยู่นานทำได้แล้วครับ ใช้ Between ซ้อน Between Code (PHP)
if($_GET["dateStart"] or $_GET["dateStop"]!= ""){
//$strSQL = "SELECT * FROM tbl_spc WHERE (Date BETWEEN '".$_GET["dateStart"]."' AND '".$_GET["dateStop"]."')";
$strSQL = "SELECT * FROM tbl_spc WHERE (Date BETWEEN '".$_GET["dateStart"]."' AND '".$_GET["dateStop"]."')AND (Station BETWEEN '".$_GET["Station"]."' AND '".$_GET["Station"]."')";
} else
$strSQL = "SELECT * FROM tbl_spc";