แสดงข้อมูลออกมาแล้ว ต้องการคลิ๊กเพื่อให้แสดงข้อมูลว่า มีรายการอะไรบ้าง
echo ค่าออกมาแล้ว ต้องการกดที่ เลขแล้ว ย้อนกลับไปแสดงเป็นรายการได้ว่า มันมีรายการอะไรบ้างอ่ะครับ
Code (PHP)
<?php session_start();
include("connect/connection.php");
include("f_thaidate.php");
$nameentry = $_SESSION["FirstName"];
$level = $_SESSION["Level"];
$department3 = $_SESSION["department3"];
?>
<!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>ระบบจัดการข้อมูลศูนย์บริการ</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="css/templatemo_style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script language="javascript">
window.onload = function () {
var a=document.getElementById('mytable'); // อ้างอิงตารางด้วยตัวแปร a
for(i=0;i<a.rows.length;i++){ // วน Loop นับจำนวนแถวในตาราง
if(i>0){ // ตรวจสอบถ้าไม่ใช่แถวหัวข้อ
if(i%2==1){ // ตรวจสอบถ้าไม่ใช่แถวรายละเอียด
a.rows[i].className="tr_odd"; // กำหนด class แถวแรก
}else{
a.rows[i].className="tr_even"; // กำหนด class แถวที่สอง
}
}else{ // ถ้าเป็นแถวหัวข้อกำหนด class
a.rows[i].className="tr_head";
}
}
}
</script>
<!-- editor -->
<link href="components/editor/jquery.cleditor.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="components/editor/jquery.cleditor.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#textEditor").cleditor({
width: 800, // width not including margins, borders or padding
height: 250, // height not including margins, borders or padding
});
});
</script>
</head>
<body>
<?php
$dd = date("Y-m-d");
$tt = date("H:i:s");
?>
<div id="templatemo_wrapper">
<div id="templatemo_header2">
<div id="site_title">
<!-- <h1><a href="http://www.templatemo.com">BLUE<strong>URBAN</strong><span>YOUR TAGLINE GOES HERE</span></a></h1>-->
</div> <!-- end of site_title -->
<div id="templatemo_menu">
<?php include('menu_header.php'); ?>
</div> <!-- end of templatemo_menu -->
</div>
<div id="templatemo_content">
<!--<div class="col_w300">
<h3>ABOUT US</h3>
<div class="image_wrapper"><img src="images/templatemo_image_01.jpg" alt="Image 01" /></div>
<p><em>Etiam ut urna ante, ut pulvinar ante. Vivamus a metus quam. Aenean non eros nunc. </em></p>
<p align="justify">Blue Urban is a <a href="http://www.templatemo.com" target="_parent">free CSS template</a> from <a href="http://www.templatemo.com" target="_parent">templatemo.com</a> website. You may use this template in your websites. Credit goes to <a href="http://www.photovaco.com/" target="_blank">Free Photos</a> for photos. </p>
<p align="justify">Sed nec nisl vitae tellus mattis tristique a quis nunc. Morbi nisi est, vehicula nec imper diet at, congue ornare lorem. Ut diam arcu, molestie sed sagittis ut sed. Validate <a href="http://validator.w3.org/check?uri=referer" rel="nofollow"><strong>XHTML</strong></a> & <a href="http://jigsaw.w3.org/css-validator/check/referer" rel="nofollow"><strong>CSS</strong></a>.</p>
<div class="btn_more"><a href="about.html">Read more</a></div>
</div>-->
<!--<div class="col_w300">
<h3>OUR SERVICES</h3>
<p><em>Morbi sed nulla ac est cursus suscipit eu ac lectus. Curabitur ullamcorper nibh nisi, sed eleifend dolor.</em></p>
<p align="justify">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eget sollicitudin turpis. Praesent facilisis orci vitae ante dignissim ultrices. Curabitur convallis molestie sem, et egestas enim ornare non. Donec tincidunt neque a ante bibendum iaculis.</p>
<ul class="tmo_list">
<li>Aliquam tempus tellus eu purus </li>
<li>Fusce eget mauris quis odio sagit </li>
<li>Pellentesque malesuada massa vel</li>
<li>Vivamus interdum orci fringilla</li>
</ul>
<div class="cleaner"></div>
<div class="btn_more"><a href="services.html">Read more</a></div>
</div>-->
<!--<div class="col_w300 col_last">
<h3>OUR NEWS</h3>
<div class="sb_news_box">
<div class="news_date">OCT 29, 2048</div>
<img src="images/templatemo_image_05.jpg" alt="Image 05" />
<h6><a href="#">Ut volutpat erat nec mauris</a></h6>
Fusce sem nulla, rutrum ac suscipit eget, commodo est.
<div class="cleaner"></div>
</div>
<div class="sb_news_box">
<div class="news_date">OCT 23, 2048</div>
<img src="images/templatemo_image_06.jpg" alt="Image 06" />
<h6><a href="#">Vestibulum pharetra tortor</a></h6>
Donec et purus velit, eget euismod risus consectetur dolo.
<div class="cleaner"></div>
</div>
<div class="sb_news_box">
<div class="news_date">OCT 17, 2048</div>
<img src="images/templatemo_image_07.jpg" alt="Image 07" />
<h6><a href="#">Morbi vitae velit eget</a></h6>
Cras suscipit condimentum dolor, in facilisis est adipiscing.
<div class="cleaner"></div>
</div>
<div class="btn_more"><a href="news.html">Read more</a></div>
</div>-->
<div id="box850">
<h3><img src="images/icon/64/comments.png" width="28" height="28" style="vertical-align:middle"/> แผนปฏิบัติงานรายเดือน /<font color="#0000FF">แผนปฏิบัติงานรายเดือน</font></h3><br />
<center>
<h3>:: แผนปฏิบัติงานรายเดือน ::</h3><br />
<form id="form1" name="form1" method="post" action="plan_result1.php"><strong>เลือกเดือน :</strong>
<select name="tfSearch" id="tfSearch">
<option value=" " selected="selected"> </option>
<option value="01">มกราคม</option>
<option value="02">กุมภาพันธ์</option>
<option value="03">มีนาคม</option>
<option value="04">เมษายน</option>
<option value="05">พฤษภาคม</option>
<option value="06">มิถุนายน</option>
<option value="07">กรกฎาคม</option>
<option value="08">สิงหาคม</option>
<option value="09">กันยายน</option>
<option value="10">ตุลาคม</option>
<option value="11">พฤศจิกายน</option>
<option value="12">ธันวาคม</option>
</select>
<input type="submit" name="btSearch" id="btSearch" value="Search" /></form>
<p>
<?PHP
$strSearch=$_POST['tfSearch'];
//------------------------------- 1 ---------------------------------------------------
$Num10 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มพัฒนาภาคีเครือข่าย' and month(dateentry) = '$strSearch' ";
$Num11 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มพัฒนาภาคีเครือข่าย' and month(dateentry) = '$strSearch'";
$Num12 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มพัฒนาภาคีเครือข่าย' and month(dateentry) = '$strSearch'";
$Num13 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มพัฒนาภาคีเครือข่าย' and month(dateentry) = '$strSearch'";
$Num14 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มพัฒนาภาคีเครือข่าย' and month(dateentry) = '$strSearch'";
$Num15 = "select count(*) from other where department3= 1";
$result10=mysql_query($Num10);
$result11=mysql_query($Num11);
$result12=mysql_query($Num12);
$result13=mysql_query($Num13);
$result14=mysql_query($Num14);
$result15=mysql_query($Num15);
$row10= mysql_fetch_row($result10);
$row11= mysql_fetch_row($result11);
$row12= mysql_fetch_row($result12);
$row13= mysql_fetch_row($result13);
$row14= mysql_fetch_row($result14);
$row15= mysql_fetch_row($result15);
//------------------------------- 2 ---------------------------------------------------
$Num20 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มพัฒนาวิชาการ' and month(dateentry) = '$strSearch' ";
$Num21 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มพัฒนาวิชาการ' and month(dateentry) = '$strSearch'";
$Num22 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มพัฒนาวิชาการ' and month(dateentry) = '$strSearch'";
$Num23 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มพัฒนาวิชาการ' and month(dateentry) = '$strSearch'";
$Num24 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มพัฒนาวิชาการ' and month(dateentry) = '$strSearch'";
$Num25 = "select count(*) from other where department3= 2 ";
$result20=mysql_query($Num20);
$result21=mysql_query($Num21);
$result22=mysql_query($Num22);
$result23=mysql_query($Num23);
$result24=mysql_query($Num24);
$result25=mysql_query($Num25);
$row20= mysql_fetch_row($result20);
$row21= mysql_fetch_row($result21);
$row22= mysql_fetch_row($result22);
$row23= mysql_fetch_row($result23);
$row24= mysql_fetch_row($result24);
$row25= mysql_fetch_row($result25);
//------------------------------- 3 ---------------------------------------------------
$Num30 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มสื่อสารความเสี่ยงฯ' and month(dateentry) = '$strSearch' ";
$Num31 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มสื่อสารความเสี่ยงฯ' and month(dateentry) = '$strSearch'";
$Num32 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มสื่อสารความเสี่ยงฯ' and month(dateentry) = '$strSearch'";
$Num33 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มสื่อสารความเสี่ยงฯ' and month(dateentry) = '$strSearch'";
$Num34 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มสื่อสารความเสี่ยงฯ' and month(dateentry) = '$strSearch'";
$Num35 = "select count(*) from other where department3= 3 ";
$result30=mysql_query($Num30);
$result31=mysql_query($Num31);
$result32=mysql_query($Num32);
$result33=mysql_query($Num33);
$result34=mysql_query($Num34);
$result35=mysql_query($Num35);
$row30= mysql_fetch_row($result30);
$row31= mysql_fetch_row($result31);
$row32= mysql_fetch_row($result32);
$row33= mysql_fetch_row($result33);
$row34= mysql_fetch_row($result34);
$row35= mysql_fetch_row($result35);
//------------------------------- 4 ---------------------------------------------------
$Num40 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มระบาดวิทยาและข่าวกรอง' and month(dateentry) = '$strSearch' ";
$Num41 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มระบาดวิทยาและข่าวกรอง' and month(dateentry) = '$strSearch'";
$Num42 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มระบาดวิทยาและข่าวกรอง' and month(dateentry) = '$strSearch'";
$Num43 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มระบาดวิทยาและข่าวกรอง' and month(dateentry) = '$strSearch'";
$Num44 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มระบาดวิทยาและข่าวกรอง' and month(dateentry) = '$strSearch'";
$Num45 = "select count(*) from other where department3= 4 ";
$result40=mysql_query($Num40);
$result41=mysql_query($Num41);
$result42=mysql_query($Num42);
$result43=mysql_query($Num43);
$result44=mysql_query($Num44);
$result45=mysql_query($Num45);
$row40= mysql_fetch_row($result40);
$row41= mysql_fetch_row($result41);
$row42= mysql_fetch_row($result42);
$row43= mysql_fetch_row($result43);
$row44= mysql_fetch_row($result44);
$row45= mysql_fetch_row($result45);
//------------------------------- 5 ---------------------------------------------------
$Num50 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มแผนงานและประเมินผล' and month(dateentry) = '$strSearch' ";
$Num51 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มแผนงานและประเมินผล' and month(dateentry) = '$strSearch'";
$Num52 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มแผนงานและประเมินผล' and month(dateentry) = '$strSearch'";
$Num53 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มแผนงานและประเมินผล' and month(dateentry) = '$strSearch'";
$Num54 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มแผนงานและประเมินผล' and month(dateentry) = '$strSearch'";
$Num55 = "select count(*) from other where department3= 5 ";
$result50=mysql_query($Num50);
$result51=mysql_query($Num51);
$result52=mysql_query($Num52);
$result53=mysql_query($Num53);
$result54=mysql_query($Num54);
$result55=mysql_query($Num55);
$row50= mysql_fetch_row($result50);
$row51= mysql_fetch_row($result51);
$row52= mysql_fetch_row($result52);
$row53= mysql_fetch_row($result53);
$row54= mysql_fetch_row($result54);
$row55= mysql_fetch_row($result55);
//------------------------------- 6 ---------------------------------------------------
$Num60 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มพัฒนาองค์กร' and month(dateentry) = '$strSearch' ";
$Num61 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มพัฒนาองค์กร' and month(dateentry) = '$strSearch'";
$Num62 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มพัฒนาองค์กร' and month(dateentry) = '$strSearch'";
$Num63 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มพัฒนาองค์กร' and month(dateentry) = '$strSearch'";
$Num64 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มพัฒนาองค์กร' and month(dateentry) = '$strSearch'";
$Num65 = "select count(*) from other where department3= 6 ";
$result60=mysql_query($Num60);
$result61=mysql_query($Num61);
$result62=mysql_query($Num62);
$result63=mysql_query($Num63);
$result64=mysql_query($Num64);
$result65=mysql_query($Num65);
$row60= mysql_fetch_row($result60);
$row61= mysql_fetch_row($result61);
$row62= mysql_fetch_row($result62);
$row63= mysql_fetch_row($result63);
$row64= mysql_fetch_row($result64);
$row65= mysql_fetch_row($result65);
//------------------------------- 7 ---------------------------------------------------
$Num70 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มปฏิบัติการควบคุมโรคฯ' and month(dateentry) = '$strSearch' ";
$Num71 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มปฏิบัติการควบคุมโรคฯ' and month(dateentry) = '$strSearch'";
$Num72 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มปฏิบัติการควบคุมโรคฯ' and month(dateentry) = '$strSearch'";
$Num73 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มปฏิบัติการควบคุมโรคฯ' and month(dateentry) = '$strSearch'";
$Num74 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มปฏิบัติการควบคุมโรคฯ' and month(dateentry) = '$strSearch'";
$Num75 = "select count(*) from other where department3= 7 ";
$result70=mysql_query($Num70);
$result71=mysql_query($Num71);
$result72=mysql_query($Num72);
$result73=mysql_query($Num73);
$result74=mysql_query($Num74);
$result75=mysql_query($Num75);
$row70= mysql_fetch_row($result70);
$row71= mysql_fetch_row($result71);
$row72= mysql_fetch_row($result72);
$row73= mysql_fetch_row($result73);
$row74= mysql_fetch_row($result74);
$row75= mysql_fetch_row($result75);
//------------------------------- 8 ---------------------------------------------------
$Num80 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มห้องปฏิบัติการทางการแพทย์' and month(dateentry) = '$strSearch' ";
$Num81 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มห้องปฏิบัติการทางการแพทย์' and month(dateentry) = '$strSearch'";
$Num82 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มห้องปฏิบัติการทางการแพทย์' and month(dateentry) = '$strSearch'";
$Num83 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มห้องปฏิบัติการทางการแพทย์' and month(dateentry) = '$strSearch'";
$Num84 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มห้องปฏิบัติการทางการแพทย์' and month(dateentry) = '$strSearch'";
$Num85 = "select count(*) from other where department3= 8 ";
$result80=mysql_query($Num80);
$result81=mysql_query($Num81);
$result82=mysql_query($Num82);
$result83=mysql_query($Num83);
$result84=mysql_query($Num84);
$result85=mysql_query($Num85);
$row80= mysql_fetch_row($result80);
$row81= mysql_fetch_row($result81);
$row82= mysql_fetch_row($result82);
$row83= mysql_fetch_row($result83);
$row84= mysql_fetch_row($result84);
$row85= mysql_fetch_row($result85);
//------------------------------- 9 ---------------------------------------------------
$Num90 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มบริหารทั่วไป' and month(dateentry) = '$strSearch' ";
$Num91 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มบริหารทั่วไป' and month(dateentry) = '$strSearch'";
$Num92 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มบริหารทั่วไป' and month(dateentry) = '$strSearch'";
$Num93 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มบริหารทั่วไป' and month(dateentry) = '$strSearch'";
$Num94 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มบริหารทั่วไป' and month(dateentry) = '$strSearch'";
$Num95 = "select count(*) from other where department3= 9 ";
$result90=mysql_query($Num90);
$result91=mysql_query($Num91);
$result92=mysql_query($Num92);
$result93=mysql_query($Num93);
$result94=mysql_query($Num94);
$result95=mysql_query($Num95);
$row90= mysql_fetch_row($result90);
$row91= mysql_fetch_row($result91);
$row92= mysql_fetch_row($result92);
$row93= mysql_fetch_row($result93);
$row94= mysql_fetch_row($result94);
$row95= mysql_fetch_row($result95);
//------------------------------- 10 ---------------------------------------------------
$Num100 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มควบคุมโรคเขตเมือง' and month(dateentry) = '$strSearch' ";
$Num101 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มควบคุมโรคเขตเมือง' and month(dateentry) = '$strSearch'";
$Num102 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มควบคุมโรคเขตเมือง' and month(dateentry) = '$strSearch'";
$Num103 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มควบคุมโรคเขตเมือง' and month(dateentry) = '$strSearch'";
$Num104 = "select sum(budget) from tbl_plan where status='t' and department3='กลุ่มควบคุมโรคเขตเมือง' and month(dateentry) = '$strSearch'";
$Num105 = "select count(*) from other where department3= 10 ";
$result100=mysql_query($Num100);
$result101=mysql_query($Num101);
$result102=mysql_query($Num102);
$result103=mysql_query($Num103);
$result104=mysql_query($Num104);
$result105=mysql_query($Num105);
$row100= mysql_fetch_row($result100);
$row101= mysql_fetch_row($result101);
$row102= mysql_fetch_row($result102);
$row103= mysql_fetch_row($result103);
$row104= mysql_fetch_row($result104);
$row105= mysql_fetch_row($result105);
//------------------------------- 11 ---------------------------------------------------
$Num110 = "select count(*) from tbl_plan where result=1 and status='t' and department3='ศตม.2.1 จ.พิษณุโลก' and month(dateentry) = '$strSearch' ";
$Num111 = "select count(*) from tbl_plan where result=2 and status='t' and department3='ศตม.2.1 จ.พิษณุโลก' and month(dateentry) = '$strSearch'";
$Num112 = "select count(*) from tbl_plan where result=3 and status='t' and department3='ศตม.2.1 จ.พิษณุโลก' and month(dateentry) = '$strSearch'";
$Num113 = "select count(*) from tbl_plan where status='t' and department3='ศตม.2.1 จ.พิษณุโลก' and month(dateentry) = '$strSearch'";
$Num114 = "select sum(budget) from tbl_plan where status='t' and department3='ศตม.2.1 จ.พิษณุโลก' and month(dateentry) = '$strSearch'";
$Num115 = "select count(*) from other where department3= 11 ";
$result110=mysql_query($Num110);
$result111=mysql_query($Num111);
$result112=mysql_query($Num112);
$result113=mysql_query($Num113);
$result114=mysql_query($Num114);
$result115=mysql_query($Num115);
$row110= mysql_fetch_row($result110);
$row111= mysql_fetch_row($result111);
$row112= mysql_fetch_row($result112);
$row113= mysql_fetch_row($result113);
$row114= mysql_fetch_row($result114);
$row115= mysql_fetch_row($result115);
//------------------------------- 12 ---------------------------------------------------
$Num120 = "select count(*) from tbl_plan where result=1 and status='t' and department3='ศตม.2.2 จ.เพชรบูรณ์' and month(dateentry) = '$strSearch' ";
$Num121 = "select count(*) from tbl_plan where result=2 and status='t' and department3='ศตม.2.2 จ.เพชรบูรณ์' and month(dateentry) = '$strSearch'";
$Num122 = "select count(*) from tbl_plan where result=3 and status='t' and department3='ศตม.2.2 จ.เพชรบูรณ์' and month(dateentry) = '$strSearch'";
$Num123 = "select count(*) from tbl_plan where status='t' and department3='ศตม.2.2 จ.เพชรบูรณ์' and month(dateentry) = '$strSearch'";
$Num124 = "select sum(budget) from tbl_plan where status='t' and department3='ศตม.2.2 จ.เพชรบูรณ์' and month(dateentry) = '$strSearch'";
$Num125 = "select count(*) from other where department3= 12 ";
$result120=mysql_query($Num120);
$result121=mysql_query($Num121);
$result122=mysql_query($Num122);
$result123=mysql_query($Num123);
$result124=mysql_query($Num124);
$result125=mysql_query($Num125);
$row120= mysql_fetch_row($result120);
$row121= mysql_fetch_row($result121);
$row122= mysql_fetch_row($result122);
$row123= mysql_fetch_row($result123);
$row124= mysql_fetch_row($result124);
$row125= mysql_fetch_row($result125);
//------------------------------- 13 ---------------------------------------------------
$Num130 = "select count(*) from tbl_plan where result=1 and status='t' and department3='ศตม.2.3 แม่สอด จ.ตาก' and month(dateentry) = '$strSearch' ";
$Num131 = "select count(*) from tbl_plan where result=2 and status='t' and department3='ศตม.2.3 แม่สอด จ.ตาก' and month(dateentry) = '$strSearch'";
$Num132 = "select count(*) from tbl_plan where result=3 and status='t' and department3='ศตม.2.3 แม่สอด จ.ตาก' and month(dateentry) = '$strSearch'";
$Num133 = "select count(*) from tbl_plan where status='t' and department3='ศตม.2.3 แม่สอด จ.ตาก' and month(dateentry) = '$strSearch'";
$Num134 = "select sum(budget) from tbl_plan where status='t' and department3='ศตม.2.3 แม่สอด จ.ตาก' and month(dateentry) = '$strSearch'";
$Num135 = "select count(*) from other where department3= 13 ";
$result130=mysql_query($Num130);
$result131=mysql_query($Num131);
$result132=mysql_query($Num132);
$result133=mysql_query($Num133);
$result134=mysql_query($Num134);
$result135=mysql_query($Num135);
$row130= mysql_fetch_row($result130);
$row131= mysql_fetch_row($result131);
$row132= mysql_fetch_row($result132);
$row133= mysql_fetch_row($result133);
$row134= mysql_fetch_row($result134);
$row135= mysql_fetch_row($result135);
//------------------------------- 14 ---------------------------------------------------
$Num140 = "select count(*) from tbl_plan where result=1 and status='t' and department3='ด่านฯ แม่สอด จ.ตาก' and month(dateentry) = '$strSearch' ";
$Num141 = "select count(*) from tbl_plan where result=2 and status='t' and department3='ด่านฯ แม่สอด จ.ตาก' and month(dateentry) = '$strSearch'";
$Num142 = "select count(*) from tbl_plan where result=3 and status='t' and department3='ด่านฯ แม่สอด จ.ตาก' and month(dateentry) = '$strSearch'";
$Num143 = "select count(*) from tbl_plan where status='t' and department3='ด่านฯ แม่สอด จ.ตาก' and month(dateentry) = '$strSearch'";
$Num144 = "select sum(budget) from tbl_plan where status='t' and department3='ด่านฯ แม่สอด จ.ตาก' and month(dateentry) = '$strSearch'";
$Num145 = "select count(*) from other where department3= 14 ";
$result140=mysql_query($Num140);
$result141=mysql_query($Num141);
$result142=mysql_query($Num142);
$result143=mysql_query($Num143);
$result144=mysql_query($Num144);
$result145=mysql_query($Num145);
$row140= mysql_fetch_row($result140);
$row141= mysql_fetch_row($result141);
$row142= mysql_fetch_row($result142);
$row143= mysql_fetch_row($result143);
$row144= mysql_fetch_row($result144);
$row145= mysql_fetch_row($result145);
//------------------------------- 15 ---------------------------------------------------
$Num150 = "select count(*) from tbl_plan where result=1 and status='t' and department3='ด่านฯ ภูดู่ จ.อุตรดิตถ์' and month(dateentry) = '$strSearch' ";
$Num151 = "select count(*) from tbl_plan where result=2 and status='t' and department3='ด่านฯ ภูดู่ จ.อุตรดิตถ์' and month(dateentry) = '$strSearch'";
$Num152 = "select count(*) from tbl_plan where result=3 and status='t' and department3='ด่านฯ ภูดู่ จ.อุตรดิตถ์' and month(dateentry) = '$strSearch'";
$Num153 = "select count(*) from tbl_plan where status='t' and department3='ด่านฯ ภูดู่ จ.อุตรดิตถ์' and month(dateentry) = '$strSearch'";
$Num154 = "select sum(budget) from tbl_plan where status='t' and department3='ด่านฯ ภูดู่ จ.อุตรดิตถ์' and month(dateentry) = '$strSearch'";
$Num155 = "select count(*) from other where department3= 15 ";
$result150=mysql_query($Num150);
$result151=mysql_query($Num151);
$result152=mysql_query($Num152);
$result153=mysql_query($Num153);
$result154=mysql_query($Num154);
$result155=mysql_query($Num155);
$row150= mysql_fetch_row($result150);
$row151= mysql_fetch_row($result151);
$row152= mysql_fetch_row($result152);
$row153= mysql_fetch_row($result153);
$row154= mysql_fetch_row($result154);
$row155= mysql_fetch_row($result155);
//------------------------------- 16 ---------------------------------------------------
$Num160 = "select count(*) from tbl_plan where result=1 and status='t' and department3='กลุ่มนิติการ' and month(dateentry) = '$strSearch' ";
$Num161 = "select count(*) from tbl_plan where result=2 and status='t' and department3='กลุ่มนิติการ' and month(dateentry) = '$strSearch'";
$Num162 = "select count(*) from tbl_plan where result=3 and status='t' and department3='กลุ่มนิติการ' and month(dateentry) = '$strSearch'";
$Num163 = "select count(*) from tbl_plan where status='t' and department3='กลุ่มนิติการ' and month(dateentry) = '$strSearch'";
$Num164 = "select sum(budget) from tbl_plan where status='t' and nameentry='Preedeesakห' and month(dateentry) = '$strSearch'";
$Num165 = "select count(*) from other where department3= 16 ";
$result160=mysql_query($Num160);
$result161=mysql_query($Num161);
$result162=mysql_query($Num162);
$result163=mysql_query($Num163);
$result164=mysql_query($Num164);
$result165=mysql_query($Num165);
$row160= mysql_fetch_row($result160);
$row161= mysql_fetch_row($result161);
$row162= mysql_fetch_row($result162);
$row163= mysql_fetch_row($result163);
$row164= mysql_fetch_row($result164);
$row165= mysql_fetch_row($result165);
//------------------------------- รวม ---------------------------------------------------
$Num9990 = "select count(*) from tbl_plan where result=1 and status='t' and month(dateentry) = '$strSearch' ";
$Num9991 = "select count(*) from tbl_plan where result=2 and status='t' and month(dateentry) = '$strSearch'";
$Num9992 = "select count(*) from tbl_plan where result=3 and status='t' and month(dateentry) = '$strSearch'";
$Num9993 = "select count(*) from tbl_plan where status='t' and month(dateentry) = '$strSearch'";
$Num9994 = "select sum(budget) from tbl_plan where status='t' and month(dateentry) = '$strSearch'";
$Num9995 = "select count(*) from other where status = 1";
$result9990=mysql_query($Num9990);
$result9991=mysql_query($Num9991);
$result9992=mysql_query($Num9992);
$result9993=mysql_query($Num9993);
$result9994=mysql_query($Num9994);
$result9995=mysql_query($Num9995);
$row9990= mysql_fetch_row($result9990);
$row9991= mysql_fetch_row($result9991);
$row9992= mysql_fetch_row($result9992);
$row9993= mysql_fetch_row($result9993);
$row9994= mysql_fetch_row($result9994);
$row9995= mysql_fetch_row($result9995);
//----------------------------------------------------------------------------------
//mysql_free_result($row0);
?>
</p>
<table width="60%" border="0" id="" cellspacing="0" class="table">
<tr>
<td align="center" bgcolor="#2766C5"><font color="white"><strong>กลุ่ม/ศูนย์</strong></font></td>
<td align="center" bgcolor="#2766C5"><strong><font color="white">จำนวนกิจกรรม</font></strong></td>
<td align="center" bgcolor="#2766C5"><font color="white"><strong>งบประมาณ<br />
(บาท)</strong></font></td>
</tr>
<tr>
<td>1. กลุ่มพัฒนาภาคีเครือข่าย</td>
<td align="center"><?PHP echo $row13[0];?></a></td>
<td align="center"><?PHP echo number_format($row14[0]);?></td>
</tr>
<tr>
<td>2. กลุ่มพัฒนาวิชาการ</td>
<td align="center"><?PHP echo $row23[0];?></td>
<td align="center"><?PHP echo number_format($row24[0]);?></td>
</tr>
<tr>
<td>3. กลุ่มสื่อสารความเสี่ยงฯ</td>
<td align="center"><?PHP echo $row33[0];?></td>
<td align="center"><?PHP echo number_format($row34[0]);?></td>
</tr>
<tr>
<td>4. กลุ่มระบาดวิทยาและข่าวกรอง</td>
<td align="center"><?PHP echo $row43[0];?></td>
<td align="center"><?PHP echo number_format($row44[0]);?></td>
</tr>
<tr>
<td>5. กลุ่มแผนงานและประเมินผล</td>
<td align="center"><?PHP echo $row53[0];?></td>
<td align="center"><?PHP echo number_format($row54[0]);?></td>
</tr>
<tr>
<td>6. กลุ่มพัฒนาองค์กร</td>
<td align="center"><?PHP echo $row63[0];?></td>
<td align="center"><?PHP echo number_format($row64[0]);?></td>
</tr>
<tr>
<td>7. กลุ่มปฏิบัติการควบคุมโรคฯ</td>
<td align="center"><?PHP echo $row73[0];?></td>
<td align="center"><?PHP echo number_format($row74[0]);?></td>
</tr>
<tr>
<td>8. กลุ่มห้องปฏิบัติการทางการแพทย์</td>
<td align="center"><?PHP echo $row83[0];?></td>
<td align="center"><?PHP echo number_format($row84[0]);?></td>
</tr>
<tr>
<td>9. กลุ่มบริหารทั่วไป</td>
<td align="center"><?PHP echo $row93[0];?></td>
<td align="center"><?PHP echo number_format($row94[0]);?></td>
</tr>
<tr>
<td>10. กลุ่มควบคุมโรคเขตเมืองฯ</td>
<td align="center"><?PHP echo $row103[0];?></td>
<td align="center"><?PHP echo number_format($row104[0]);?></td>
</tr>
<tr>
<td>11. กลุ่มนิติการ</td>
<td align="center"><?PHP echo $row163[0];?></td>
<td align="center"><?PHP echo number_format($row164[0]);?></td>
</tr>
<tr>
<td>12. ศตม. 2.1 จังหวัดพิษณุโลก</td>
<td align="center"><?PHP echo $row113[0];?></td>
<td align="center"><?PHP echo number_format($row114[0]);?></td>
</tr>
<tr>
<td>13. ศตม. 2.2 จังหวัดเพชรบูรณ์</td>
<td align="center"><?PHP echo $row123[0];?></td>
<td align="center"><?PHP echo number_format($row124[0]);?></td>
</tr>
<tr>
<td>14. ศตม. 2.3 แม่สอด จังหวัดตาก</td>
<td align="center"><?PHP echo $row133[0];?></td>
<td align="center"><?PHP echo number_format($row134[0]);?></td>
</tr>
<tr>
<td> </td>
<td align="center"> </td>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><strong>รวมทั้งสิ้น</strong></td>
<td align="center"><?PHP echo $row9993[0];?></td>
<td align="center"><?PHP echo number_format($row9994[0]);?></td>
</tr>
</table>
<p> </p>
</center>
</div><!--close box850-->
<br />
<center>
<?php // include('server_datetime.php'); ?>
</center>
<div class="cleaner"></div>
</div>
<div id="templatemo_footer">
<?php include('footter.php'); ?>
</div>
</body>
</html>
Tag : PHP, MySQL, Google Chrome
Date :
2018-11-08 11:48:28
By :
arm_s
View :
1034
Reply :
3
Code (PHP)
<tr>
<td>1. กลุ่มพัฒนาภาคีเครือข่าย</td>
<td align="center"><a href="page.php?id=<?php echo $row['PK_id'];?>"><?PHP echo $row13[0];?></a></td>//ใส่ตรงนี้ครับ โดยไปยังอีกหน้าก็ให้ใส่ page อีกหน้าครับ โดยให้อ้างอิงอะไรก็ว่ากันไป
<td align="center"><?PHP echo number_format($row14[0]);?></td>
</tr>
Date :
2018-11-08 13:27:32
By :
nobetaking
ใส่ link เข้าไปด้วยครับ
Code (PHP)
<tr>
<td>1. กลุ่มพัฒนาภาคีเครือข่าย</td>
<td align="center"><a href="yoururl?group_id=1" ><?PHP echo $row13[0];?></a></td>
<td align="center"><?PHP echo number_format($row14[0]);?></td>
</tr>
แต่โค๊ดที่ทำ นี่ไม่เหมาะใช้งาน หลาย user นะครับ คิวรี่ หลายครั้งเกิน อาจทำให้ connection ตายได้
อะไร รวมกันได้ ก็จับรวมซะ
Code (PHP)
$Num10 = "select result, count(*) as c from tbl_plan
where result=in(1,2,3) and status='t' and month(dateentry) = '$strSearch'
group by result , department3";
$Num13 = "select count(*), sum(budget)
from tbl_plan
where status='t' and month(dateentry) = '$strSearch'
group by department3";
$Num15 = "select count(*) from other where department3= 1";
แล้ว ใช้ main code แบ่งข้อมูลเพื่อแสดงผล อีกที
โปรแกรม อาจเขียนง่าย copy มาวาง แต่เซิฟทำงานหนัก ก็เลือกเอานะครับ
Date :
2018-11-08 13:40:36
By :
Chaidhanan
ขอบคุณพี่ๆ ทั้ง 2 ท่านด้วยครับ เดี๋ยวผมลองทำ ปรับตามที่แนะนำมาครับ
Date :
2018-11-08 13:48:37
By :
arm_s
Load balance : Server 03