Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ทำหน้า dashboard ให้เป็น realtime โดยใช้ ajax ตอนนี้เกิดปัญหา ขอคำแนะนำหน่อยครับ



 

ทำหน้า dashboard ให้เป็น realtime โดยใช้ ajax ตอนนี้เกิดปัญหา ขอคำแนะนำหน่อยครับ

 



Topic : 135861



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์




ทำหน้า dashboard ให้เป็น realtime โดยใช้ ajax ตอนนี้เกิดปัญหาครับ กรณีเจอปัญหาแบบนี้เกิดจากอะไรหรอครับ ajax realtime

Notice: Undefined index: rev in C:\xampp\htdocs\ComputerManagement\ajax_realtime.php on line 30 (ตัวแปร rev มีนะครับ)

1. code ajax realtime ดึงข้อมูลหน้า dashboardcms.php

ajax

2. ผลลัพธ์ error

load


(ช่วยผมด้วยครับไม่ถนัด ajax ครับพึ่งศึกษาครับ)
ศึกษาตัวอย่าง code จาก CR. www.ninenik.com/แนวทาง_การดึงข้อมูล_แบบ_real_time_ด้วย_ajax_ใน_jQuery_-284.html



Tag : PHP, MySQL, JavaScript, Ajax









ประวัติการแก้ไข
2021-01-25 11:34:23
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2021-01-25 11:33:39 By : chawa-2011 View : 5298 Reply : 129
 

 

No. 1



โพสกระทู้ ( 4,169 )
บทความ ( 7 )

Hall of Fame 2012

สถานะออฟไลน์


copy เค้ามาไม่ได้อ่านคนคอมเม้นหรอครับว่า Error ??
ลองใส่ type: "POST", Or GET








ประวัติการแก้ไข
2021-01-25 12:01:41
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-25 12:01:20 By : Genesis™
 


 

No. 2



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 1 เขียนโดย : Genesis™ เมื่อวันที่ 2021-01-25 12:01:20
รายละเอียดของการตอบ ::
ขออภัยครับ code ต้นฉบับที่ศึกษาไม่มี error ครับ ผมลองเล่น demo แล้วนะครับ

รูป demo ครับ code ต้นฉบับ
demo

คือถ้า เจ้าของบอกว่า code มีบัสผมไม่เอามาหรอกครับ


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-25 13:13:46 By : chawa-2011
 

 

No. 3



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 1 เขียนโดย : Genesis™ เมื่อวันที่ 2021-01-25 12:01:20
รายละเอียดของการตอบ ::
type: "POST", Or GET ใส่ตรงไหนครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-25 13:33:05 By : chawa-2011
 


 

No. 4



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


เหมือนกระทู้นี้
https://www.thaicreate.com/php/forum/135846.html

ตอบความคิดเห็นที่ : 2 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-01-25 13:13:46
รายละเอียดของการตอบ ::
ต้นฉบับไม่มี bug แต่นำมาใช้ไม่ถูกต้อง


แผนผังการทำงานของสิ่งสมมติที่เรียกว่า AJAX

ajax

คุณทำผิดขั้นตอนที่ 2 - การ send request

เป้าหมายของ AJAX มี same page (หน้าเดิม) และ new page (หน้าใหม่ หรือคนละหน้า)

โค้ดที่คุณแปะมีเจตนาทำเป็น same page แต่กลับระบุ url option ในเมธอด ajax ของ jquery

วิธีแก้ ถ้าต้องการทำ ajax same page ไม่ต้องใส่ url


Code
var getData = ... url: ... // อันนี้ไม่ต้องใส่ data: ... success: ...

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-26 11:31:18 By : lakornworld
 


 

No. 5



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 4 เขียนโดย : lakornworld เมื่อวันที่ 2021-01-26 11:31:18
รายละเอียดของการตอบ ::
ขอบคุณครับ

ทำเป็น ajax same page ไม่ใส่ url แล้วครับ
1.หน้า dashboard.php ได้ทำการเรียก หน้า ajax_realtime.php มาใช้งานครับ แต่หน้า dashboard ไม่แสดงผล echo date("Y-m-d H:i:s"); แก้ต่อยังไงครับ

2.code ajax_realtime.php (ปิด url แล้ว)
ีพส

3 แสดงผลไม่มีอะไรเกิดขึ้นเลยครับ ค่า echo date("Y-m-d H:i:s"); ก็ไม่มาครับ
process

แก้ต่อยังไงหรอครับ




ประวัติการแก้ไข
2021-01-28 14:28:50
2021-01-29 13:11:10
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-28 14:27:24 By : chawa-2011
 


 

No. 6



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ดู console.log ครับ...
ถ้าให้เดาน่าจะเจอประมาณนี้ '$' is undefined (เพราะไม่มี header include)
ถ้าใช่ ต้องโหลด jQuery library ตรง head tag ก่อน
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 14:27:08 By : lakornworld
 


 

No. 7



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 6 เขียนโดย : lakornworld เมื่อวันที่ 2021-01-29 14:27:08
รายละเอียดของการตอบ ::
library ตัวนี้ใช่ไหมครับ ผมมี <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>





ประวัติการแก้ไข
2021-01-29 14:49:41
2021-01-29 14:50:18
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 14:43:16 By : chawa-2011
 


 

No. 8



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 7 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-01-29 14:43:16
รายละเอียดของการตอบ ::
ใช่ครับ
โหลดมาไว้ใน project หรือใช้พวก CDN (ดึงออนไลน์) ก็ได้ครับ



ประวัติการแก้ไข
2021-01-29 14:48:44
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 14:46:53 By : lakornworld
 


 

No. 9



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 8 เขียนโดย : lakornworld เมื่อวันที่ 2021-01-29 14:46:53
รายละเอียดของการตอบ ::
ตัวนี้โหลดมาไว้ใน project แล้วครับ เรียกใช้แล้วด้วยครับ <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>

ดูจาก console เกิด error แบบนี้ครับ เกิดจากอะไรครับ

dash




ประวัติการแก้ไข
2021-01-29 14:51:57
2021-01-29 14:52:13
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 14:50:42 By : chawa-2011
 


 

No. 10



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


อ่าว โทษทีผมไม่ได้เลื่อนดู เพราะภาพใหญ่กว่าหน้าจอ

แต่ยังไงลองเปลี่ยนเป็นแบบนี้ดูครับ

Code (JavaScript)
<script src="https://code.jquery.com/jquery-3.5.1.min.js">

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 15:06:46 By : lakornworld
 


 

No. 11



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 10 เขียนโดย : lakornworld เมื่อวันที่ 2021-01-29 15:06:46
รายละเอียดของการตอบ ::
ลองเปลี่ยนดูแล้วครับ ยังไม่ได้ครับ
<script language="javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 16:13:27 By : chawa-2011
 


 

No. 12



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 10 เขียนโดย : lakornworld เมื่อวันที่ 2021-01-29 15:06:46
รายละเอียดของการตอบ ::
ทำเป็น ajax same page ปิด url แล้วครับ
ดูจาก sources error แบบนี้ครับ
error

ผิดจุดไหนครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 16:27:10 By : chawa-2011
 


 

No. 13



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ลองเข้าหน้านี้ โดยตรงข้อมูลมาหรือไม่
Code
localhost/ComputerManagement/ajax_realtime.php


หรือ หน้าไหนที่กำลังแก้อยู่ ผมเริ่มงง


ปกติ ajax() จะถูกตีดออกเมื่อใช้ jquery slim แต่ดูแล้วก็ใช้ min ไม่น่ามีปัญหา


ประวัติการแก้ไข
2021-01-29 16:46:59
2021-01-29 16:49:59
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 16:46:09 By : lakornworld
 


 

No. 14



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ไม่งั้นในหน้า dashboardcms ได้โหลด jQuery หรือไม่
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 16:51:39 By : lakornworld
 


 

No. 15



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 13 เขียนโดย : lakornworld เมื่อวันที่ 2021-01-29 16:46:09
รายละเอียดของการตอบ ::
ลองเข้าหน้านี้ โดยตรงข้อมูลมาหรือไม่
localhost/ComputerManagement/ajax_realtime.php
ตอบ เข้า localhost/ComputerManagement/ajax_realtime.php แล้วครับพบ error
ไม่มา

หรือ หน้าไหนที่กำลังแก้อยู่ ผมเริ่มงง
ตอบ แก้หน้า ajax_realtime.php ครับ คือ หน้า ajax_realtime.php สร้าง script ajax
แล้วหน้า dashboardcms.php เรียกใช้งานหน้า ajax_realtime.php

ถูกไหมนะ
(ก่อนหน้า ให้ ajax ดึง url หน้า dashboardcms.php เวลารันก็รันหน้า ajax_realtime.php คนอื่นแนะนำว่า
คุณทำผิดขั้นตอนที่ 2 - การ send request
-เป้าหมายของ AJAX มี same page (หน้าเดิม) และ new page (หน้าใหม่ หรือคนละหน้า)
-โค้ดที่คุณแปะมีเจตนาทำเป็น same page แต่กลับระบุ url option ในเมธอด ajax ของ jquery
-วิธีแก้ ถ้าต้องการทำ ajax same page ไม่ต้องใส่ url ผมเลยเอา url ออกครับ )



ประวัติการแก้ไข
2021-01-29 17:11:14
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 17:09:45 By : chawa-2011
 


 

No. 16



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 14 เขียนโดย : lakornworld เมื่อวันที่ 2021-01-29 16:51:39
รายละเอียดของการตอบ ::
หน้า dashboardcms,php โหลดมาแล้ว ใส่ตามแบบนี้เหมือนกัน <script language="javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 17:13:57 By : chawa-2011
 


 

No. 17



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 15 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-01-29 17:09:45
รายละเอียดของการตอบ ::
ข้อมูลก็มาแล้วหนิครับ กำจัด Notice แก้บรรทัด 30 เป็น
Code (PHP)
if (isset($_GET['rev']) && $_GET['rev'] == 1) {




เวลานำไปใช้จริง ถ้าจะทำ same page ลบไฟล์ ajax_realtime ทิ้ง แล้วใส่โค้ดทั้งหมดในไฟล์ dashboardcms ในลักษณะนี้


Code (PHP)
<?php
// วางไว้บนๆ
if (isset($_GET['rev']) && $_GET['rev'] == 1) {
    //...ส่วนที่ต้องการนำไปแสดงแบบ realtime
}

//...

?>


<html>
<body>
...
<div id="showdata">  ต้องการโชว์เวลาที่ไหนก็วางไว้ตรงนั้น
...
<script>

... วางโค้ด ajax
</script>
</body>
</html>



ประวัติการแก้ไข
2021-01-29 17:55:26
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 17:31:10 By : lakornworld
 


 

No. 18



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 17 เขียนโดย : lakornworld เมื่อวันที่ 2021-01-29 17:31:10
รายละเอียดของการตอบ ::
แบบนี้ถูกเปล่าครับ code dashboardcms.php
<?php
require_once('connection.php');

header("Content-type:text/html; charset=UTF-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
if (isset($_GET['rev']) && $_GET['rev'] == 1) {
echo date("Y-m-d H:i:s");
exit;
}

?>
<!DOCTYPE html>
<html lang="en">

<head>
<script language="javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
</head>

<body>
<div id="showData"></div>

<script type="text/javascript">
$(function() {
setInterval(function() {

var getData = $.ajax({
type: 'GET',
data: "rev=1",
async: false,
success: function(getData) {
$("div#showData").html(getData);
}
}).responseText;
}, 5000);
});
</script>
</body>


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 21:34:12 By : chawa-2011
 


 

No. 19



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 18 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-01-29 21:34:12
รายละเอียดของการตอบ ::
ประมาณนั้นครับ แต่อย่าลืมคงโค้ดเดิมของ dashboardcms.php ผมให้คำตอบแบบคัดลอกวางไม่ได้ เพราะไม่รู้ว่าใน
dashboardcms.php แต่เดิมมีหน้าตาเป็นยังไง
แต่ถ้ามีพื้นฐานอยู่แล้ว ก็ประยุกต์ใช้ได้ไม่ยาก ตาม pattern #17 หรือทำในแบบของตัวเองก็ได้ครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-29 21:56:45 By : lakornworld
 


 
Quote:
หรือทำในแบบของตัวเองก็ได้ครับ


ผมอยากได้แบบ ในรูปแบบของตัวเอง แต่แต่แต่ ยังไม่เคยทำ
ผมต้องการ ยังไม่เคยทำ และไม่รู้ว่าต้องทำอย่างไร?
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-01-30 12:23:56 By : ผ่านมา
 


 

No. 21



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 17 เขียนโดย : lakornworld เมื่อวันที่ 2021-01-29 17:31:10
รายละเอียดของการตอบ ::
ทำแบบที่พี่แนะนำ ผมเอา code จากหน้า ajax_realtime.php ไปใส่หน้า dashboardcms.php ไม่แสดงอะไรเลยครับ
ดูจาก console error Uncaught TypeError: $.ajax is not a function at dashboardcms.php:25

ผลลัพธ์
error1

code ครับ
Code (PHP)
<?php
require_once('connection.php');

header("Content-type:text/html; charset=UTF-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
if (isset($_GET['rev']) && $_GET['rev'] == 1) {
    echo date("Y-m-d H:i:s");
    exit;
}

?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
  <!-- <link rel="stylesheet" type="text/css" href="stylesheet/styles.css"> -->
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

  <!-- <script language="javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script> -->
  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
</head>

<body>
<div id="showData"></div>

    <script type="text/javascript">
        $(function() {
            setInterval(function() { 
                var getData = $.ajax({ 
                    type: 'POST',                   
                    data: "rev=1",
                    async: false,
                    success: function(getData) {
                        $("div#showData").html(getData);
                    }
                }).responseText;
            }, 5000);
        });
    </script>


  <!-- start style -->
  <style>
    /* body {
      background-image: url('bg/bg.jpg');
      background-repeat: no-repeat;
      background-attachment: fixed;
      background-size: cover;
      background-size: 100% 100%;
    } */

    /* .container {
      max-width: 1300px;
    } */

    /* .bg-primary {
      background-color: #A4DCE9 !important;
      background-repeat: no-repeat;
      background-attachment: fixed;
      background-size: cover;
      background-size: 100% 100%;
    } */

    /* <<--------start card------>> */
    body {
      /* font-family: "Roboto", sans-serif;
      font-size: 15px; */
      /* color: #686c71; */
      font-weight: 400;
      background: #eff3f6;
      position: relative;
    }

    table,
    td,
    th {
      border: 0px solid green;

    }

    th {
      /* background-color: green; */
      color: green;
    }

    /* <<--------เว้นช่องระหว่าง card------>> */
    .card {
      border-radius: 2px;
      box-shadow: 0 0 0 1px #e2e5e8;
      border: none;
      margin-bottom: 30px;
      transition: all 0.5s ease-in-out;
    }

    /* <<--------กำหนด font h3------>> */
    /* h3 {
            font-size: 24px;
        } */

    /* <<--------ขนาด font h3------>> */
    .h3,
    h3 {
      font-size: 1.75rem;
    }

    /* <<--------site font h3------>> */
    h3 {
      display: block;
      /* font-size: 1.17em; */
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0px;
      margin-inline-end: 0px;
      font-weight: bold;

    }

    /* <<--------กำหนดขนาด icon------>> */
    .f-36 {
      font-size: 50px;
    }

    /* <<--------ขนาดความสูง card------>> */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin-top: 0;
      margin-bottom: .1rem;
    }

    /* <<--------จัดcard 20px hight/ 25px ขยับtext------>> */
    .card .card-block,
    .card .card-body {
      padding: 20px 25px;
    }

    /* <<--------เส้นแบ่งครึ่งแนวตั้ง footer ------>> */
    .card-social .card-active>div+div {
      border-left: 1px solid #e2e5e8;
    }


    /* <<--------start box1 cp3------>> */
    /* <<--------color text totalpc------>> */
    .text-c-green {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon------>> */
    .text-Info {
      color: #58C8AC !important;
    }


    /* <<--------start box2 tara------>> */
    /* <<--------color text totalpc------>> */
    .text-c-yellow {
      color: #19BCBF;

    }

    /* <<--------color text red footer------>> */
    .text-c-red {
      color: #FF425C;

    }

    /* <<--------กำหนดสี icon------>> */
    .text-danger {
      color: #58C8AC !important;
    }


    /* <<--------start box3 wfh------>> */
    /* <<--------color text totalpc------>> */
    .text-c-blue {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon ------>> */
    .text-primary {
      color: #58C8AC !important;
    }

    /* <<--------สีพื้นหลัง card cp3------>> */
    .bg-warning,
    .bg-warning>a {
      color: #fff !important;
      background-color: #92AAC7 !important;
    }

    /* <<--------สีพื้นหลัง card tara------>> */
    .bg-info,
    .bg-info>a {
      color: #fff !important;
      background-color: #B3DE81 !important;
    }

    /* <<--------สีพื้นหลัง card wfh------>> */
    .bg-danger,
    .bg-danger>a {
      color: #fff !important;
      background-color: #FCC875 !important;
    }
  </style>


  <nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase fixed-top">
    <a class="fas fa-desktop fa-2x" href="#"></a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link" href="index.php">Computer Management System<span class="sr-only">(current)</span></a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="dashboardcms.php">DashBoard</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="modalmasterpc.php">Master Pc</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="v_detail_pc.php">Detail Pc</a>
        </li>

        <li class="nav-item">
          <a class="nav-link" href="v_monitor_pc.php">Monitor Pc</a>
        </li>
      </ul>
    </div>
  </nav>
  <br>
  <br>

  <!-- start header -->
  <!-- <header class="masthead bg-primary"> -->
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/web analysic.png" alt="" width="72" height="72"> -->
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/logo dashboard.png"> -->
        <!-- <h2 class="display text-center text-uppercase">DashBoard Computer Management</h2> -->
        <br>
        <?php
        // echo "Load Time : ".date("Y-m-d H:i:s");
        // echo "Dashboard : Load Time : " . date("Y-m-d H:i:s");
        // $resultArray
        // echo json_encode($resultArray);

        ?>
        <hr>

        <!-----------------------------------start card cp3---------------------------------->
        <div class="row">
          <!-- sum total pc on-->
           <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where ip LIKE '10.183%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];

          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <?php echo $statuspc; ?></a> </h6>
                  </div>
                  <div class="col-6">
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                      <!-- <td><span class="text-c-red mb-0 "><?php echo $_arrname[$row['team']]; ?></td> -->
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          // or ip <> left( (@target_ip:=''), length(@target_ip) - LOCATE('.', REVERSE(@target_ip)) )
          
          $statuspc = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where ip LIKE '10.150%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
       
             $statuspc = $statuspc + $row['countstatus'];
        
          } ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
                        where location ='Tara park' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc; ?></h6>
                  </div>
                  <div class="col-6">
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                    and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- start card3 sum total pc on-->
          <!-- sum total pc on-->
          <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
                        where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where ip LIKE '192.168%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } 

        
          // $ip = 10.183;
          // $statuspc = 0;
          // $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where statuspc = '2';";
          // $result2 = $mysqli->query($sql);
          // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
          //  if ($ip == $statuspc){
          //    $statuspc == $statuspc + $row['countstatus'];
          //  } 
          // } 
          ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
                        where location ='wfh' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc; ?></h6>
                  </div>
                  <div class="col-6">
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                    and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon  = $row6['pcon'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>
            </div>


      <!-- ---------------------------------------------------------------------------------------------------------------->
      <hr>
      <h4 class="display text-left">PC OFF</h4>
      <br>
      <!-----------------------------------start card cp3---------------------------------->
      <div class="row">
          <!-- sum total pc on-->
           <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];

          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-green mb-0 "> </span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Off</th>
                    
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td></td>
                     
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          // $ip = 10.183;
          // or
          // left(ip,LOCATE('.', length(ip) - REVERSE(ip))) <> left('10.183.251', length('10.183.252')
          // LOCATE('.', REVERSE('10.183.253')))
          $statuspc = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where statuspc = '2' ;";

          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
          //  if ($ip = $statuspc){
          //    $statuspc = $statuspc + $row['countstatus'];
          //  } 
          } ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
                        where location ='Tara park' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-green mb-0 "> </span></h5>
                  </div>
                </div>
              </div>
              
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                    and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td></td>
                     

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- start card3 sum total pc on-->
          <!-- sum total pc on-->
          <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
                        where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          // $statuspc = 0;
          // $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where statuspc = '2';";
          // $result2 = $mysqli->query($sql);
          // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
          //   $statuspc = $statuspc + $row['countstatus'];
          // } 

        
          $ip = 10.183;
          $statuspc = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
           if ($ip == $statuspc){
             $statuspc == $statuspc + $row['countstatus'];
           } 
          } 
          ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
                        where location ='wfh' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <h5 class="text-muted ">Total PC Off <span class="text-c-green mb-0 "> </span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                    and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon  = $row6['pcon'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td></td>
                   
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>

        <script src="js/slim.js"></script>
        <script src="js/popper.js"></script>
        <script src="js/bootstrap.js"></script>

</body>

</html>




ประวัติการแก้ไข
2021-02-01 09:29:19
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-01 09:27:43 By : chawa-2011
 


 

No. 22



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


var $ = jQuery.noConflict();

ใส่ก่อนจะใช้ $
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-01 11:03:08 By : mr.v
 


 

No. 23



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 22 เขียนโดย : mr.v เมื่อวันที่ 2021-02-01 11:03:08
รายละเอียดของการตอบ ::
แบบนี้ถูกไหมครับ
Code (PHP)
 <script type="text/javascript">
        $(function() {
            setInterval(function() { // เขียนฟังก์ชัน javascript ให้ทำงานทุก ๆ 30 วินาที
                // 1 วินาที่ เท่า 1000
                // คำสั่งที่ต้องการให้ทำงาน ทุก ๆ 3 วินาที
                var $ = jQuery.noConflict();
                var getData = $.ajax({ // ใช้ ajax ด้วย jQuery ดึงข้อมูลจากฐานข้อมูล
                    type: 'POST',                   
                    data: "rev=1",
                    async: false,
                    success: function(getData) {
                        $("div#showData").html(getData); // ส่วนที่ 3 นำข้อมูลมาแสดง
                    }
                }).responseText;
            }, 5000);
        });
    </script>


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-01 13:32:16 By : chawa-2011
 


 

No. 24



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 22 เขียนโดย : mr.v เมื่อวันที่ 2021-02-01 11:03:08
รายละเอียดของการตอบ ::
var $ = jQuery.noConflict();

ใส่ก่อนจะใช้ $

ผมงงครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-01 17:44:13 By : chawa-2011
 


 

No. 25



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


งงยังไงครับ?
ก็ก่อนที่จะเรียกใช้ $ ตรงไหน ก็เอาไปใส่ในบรรทัดก่อนนั้น
แค่นี้เอง

แล้วถ้าอยากจะรู้ว่าถูกไหม ก็ลองใส่แล้ว refresh หน้าดูว่า $.ajax หรือ $.xxx is not function มันหายไหม
ถ้าหายแสดงว่าใส่ถูก ถ้าไม่หายแสดงว่าใส่ผิด
ก็มีเท่านี้เองทำไมไม่ลองดูล่ะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-01 18:08:41 By : mr.v
 


 

No. 26



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 25 เขียนโดย : mr.v เมื่อวันที่ 2021-02-01 18:08:41
รายละเอียดของการตอบ ::
งงยังไงครับ?
ก็ก่อนที่จะเรียกใช้ $ ตรงไหน ก็เอาไปใส่ในบรรทัดก่อนนั้น
แค่นี้เอง

แล้วถ้าอยากจะรู้ว่าถูกไหม ก็ลองใส่แล้ว refresh หน้าดูว่า $.ajax หรือ $.xxx is not function มันหายไหม
ถ้าหายแสดงว่าใส่ถูก ถ้าไม่หายแสดงว่าใส่ผิด
ก็มีเท่านี้เองทำไมไม่ลองดูล่ะครับ

ยังไม่ได้เลยครับ
er


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-02 10:47:00 By : chawa-2011
 


 
ผมเล่าให้ฟัง ผมไม่ได้แนะนำคุณ @Tor
ต่อให้คุณเป็นนักศึกษา หรือคุณจบดอกเตอร์ ผมก็อยากเล่าให้ฟังอยู่ดี

ยกเว้น คุณท่านที่กระผมเคารพไม่จบ ป.4 ผมถึงไม่กล้าเล่าให้ฟัง

คงต้องรบกวนท่าน @ละครชีวิต แสดงให้จบ
คงต้องรบกวนท่าน @Chaidhanan แสดงให้จบ

ปล. ผมไม่ได้ว่าอะไรถูกอะไรผิดหรอกนะ แต่ผมคิดว่า คุณใช้ความคิด/อื่นฯ มากกว่าระบบบัญชีของผมเสียอีก
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-02 13:42:27 By : ผ่านมา
 


 

No. 28



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ตอนนี้บอกได้อย่างเดียว จัดลำดับ event การเรียกใช้งานให้ถูก
event ควรนำไปไว้หลังสุด เช่น setTimeout() มันควรเรียกใช้งาน เมือน document โหลดเสร็จหมดแล้ว

และแบ่งไฟล์ แยกเป็นส่วนๆ html มันมี head มี body
มี include <link> <script src="">

ส่วนที่เป็น php กับ html ก็ควรแยกจากกัน

ก็แยกมันหน่อย จับมันมารวมกัน ผสมปนเป แก้ลำบาก อ่านก็ยาก
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-02 15:44:54 By : Chaidhanan
 


 

No. 29



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 28 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-02 15:44:54
รายละเอียดของการตอบ ::
ครับผม ผมเรียงตาม pattern #17 เลย
ทำเป็น same page ครับ ถ

แก้เป็นแบบที่พี่ Chaidhanan แนะนำ ผมเปลี่ยนเป็นแบบนี้จะถูกไหมนะ เอาจาก code เดิมมาแก้ไข
Code (PHP)
<?php
require_once('connection.php');

header("Content-type:text/html; charset=UTF-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
if (isset($_GET['rev']) && $_GET['rev'] == 1) {
    echo date("Y-m-d H:i:s");
    exit;
}

?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
 
  <!-- <script language="javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script> -->
  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
</head>

<body>
<div id="showData"></div>
function actionAjax () {
   //โค้ด ajax
         var getData = $.ajax({ 
                    type: 'POST',                   
                    data: "rev=1",
                    async: false,
                    success: function(getData) {
                        $("div#showData").html(getData); 
                    }
                }).responseText;
}

actionAjax ()

setInterval(function(){
actionAjax ()
},5000)

</body>




ประวัติการแก้ไข
2021-02-02 16:14:20
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-02 16:08:31 By : chawa-2011
 


 

No. 30



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


style แทนที่จะอยู่ใน head ก็มาอยู่ใน body

script > setInterval > ajax มาถึงก็จ่อหลังเปิด body เลย ถ้ามันมีปัญหาล่าช้าติดขัดหรือบั๊กอะไร ส่วนที่เหลือของหน้ามันจะเป็นยังไง?

พื้นฐาน html ธรรมดาก็ยังไม่แน่นเลย จะไปส่วนอื่นๆซะแล้ว


โครงสร้างมันควรจะเป็นแบบนี้

Code
<!DOCTYPE html> <html> <head> <!-- meta, style, title, link ทั้งหลายควรจะอยู่ในนี้ ไปอ่านดูอ้างอิง w3 ดูซิว่ามันใช่มั้ย? --> </head> <body> <!-- การแสดงผลในหน้าควรอยู่ตรงนี้ --> <!-- script ทั้งหลายควรจ่อปิดท้ายตรงนี้ แล้วเรียกให้มันถูกลำดับด้วย. --> </body> </html>


ลองไปค้นหา html template, html boilerplate ดูว่าเขาเริ่มต้นกันยังไง ลำดับของเขาเป็นยังไง อะไรอยู่ตรงไหน
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-02 16:30:08 By : mr.v
 


 

No. 31



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


แล้ว jquery .ajax is not function ก็ดูว่าคนอื่นเขาประกาศ jQuery กันยังไงนะครับ

https://stackoverflow.com/questions/3931529/is-not-a-function-jquery-error
https://stackoverflow.com/questions/6109847/jquery-is-not-a-function-error
https://stackoverflow.com/questions/12343714/typeerror-is-not-a-function-when-calling-jquery-function
https://stackoverflow.com/questions/33045469/function-is-not-a-function-jquery

ดูว่าต้นทางเขาแนะนำให้ใช้ยังไง
https://api.jquery.com/jquery.noconflict/

มันถูกตำแหน่งที่คุณใช้หรือเปล่า? ลองไล่ดูทีละตัวละเอียดๆกว่านี้หน่อยซิ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-02 16:34:22 By : mr.v
 


 
Code (PHP)
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
 
  <!-- <script language="javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script> -->
  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
</head>

<body>
<div id="showData"></div>
<script>
function actionAjax () {
   //โค้ด ajax
        $.ajax({ 
                    type: 'POST',  
                    url: "seed.php",                 
                    data: {rev: 1},
                    dataType  : 'json',
                    async: false,
                    success: function(data) {
                        $("#showData").html(data); 
                    }
                });
}

actionAjax ();

setInterval(function(){
actionAjax ()
}, 5000);
</script>
</body>
</html>


seed.php
Code (PHP)
<?php
$date = date("Y-m-d H:i:s");
$seedData .= "<p>Current time ass at: ".$date."</p>";
echo $seedData;
?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-02 23:04:49 By : ผ่านมา
 


 

No. 33



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


Code (PHP)
<?php
require_once('connection.php');
if (isset($_POST['rev']) && $_POST['rev'] == 1) {
   //if (isset($_GET['rev']) && $_GET['rev'] == 1) {  ajax type post แต่มาใช้ get มาจะเจอไหม
	// ส่วนของ ajax กำหนด header ใน code php แต่ส่งแค่ Date ไม่จำเป็น
	//header("Content-type:text/html; charset=UTF-8");
	//header("Cache-Control: no-store, no-cache, must-revalidate");
	//header("Cache-Control: post-check=0, pre-check=0", false);
    echo date("Y-m-d H:i:s");
    exit;
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
	<title>DashBoard</title>
  <!-- /////////////////////  ส่วน header ของ html หนัาหลัง ใส่ ตรงนี้  meta คือ header ของ php แหล่ะครับ -->
	<meta charset="utf-8" />
	<meta http-equiv="Cache-Control" content="no-cache" />
	<meta http-equiv="Expires" content="0" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
	<meta name="description" content="<?=$seo->Description?>" />
	<meta name="keywords"  content="<?=$seo->Keyword?>" />
	<meta property="og:title" content="<?=$seo->Title?>" />
	<meta property="og:image" content="<?=$seo->image?>" />
  <!-- /////////////////////  สิ้นสุด ส่วน header -->
	<link rel="stylesheet" href="bootstrap/bootstrap.css" />
 
	<script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
  <!-- /////////////////////  ใช้ bootstrap แต่ไม่มี bootstarp.js มันยังไงอยู่นะ  หรือจะเล่นแค่ css ควบคุม event เอง  ดีเสียอีก ถ้าเข้าใจ-->
	<script language="javascript" src="jquery/bootstrp.min.js"></script>
<script>
var getData; // อาจไม่จำเป็นต้องใช้
function actionAjax () {
   //โค้ด ajax
	$.ajax({ 
		type: 'POST',
		data: {
			rev: 1, 
			at: (new Date()).getTime() // ใส่ field นี้ เพื่อ กำหนดให้ อ่านใหม่ทุกครั้ง ไม่ให้ใช้ catch จะได้ไม่ต้องกำหนด header
		},   // "rev=1", หัดใช้ object มันจะถูกแปลง เป็น string เอง แบบถูกไวยกรณ์ ถูกอักขระ url-encode ไปใส่ string เอง ต้องมีความรู้ชัดเจน
		// async: false, ไม่ต้องใส่ ก็ได้ 
		error: (exception, jqXHR)=>{
			// ศึกษาเรื่อง error ต่างๆ จะได้ประฌยชน์ 
			var msg = '';
			if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.';
			} else if (jqXHR.status === 404) { msg = 'Requested page not found. [404]';
			} else if (jqXHR.status === 500) { msg = 'Internal Server Error [500].';
			} else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.';
			} else if (exception === 'timeout') { msg = 'Time out error.';
			} else if (exception === 'abort') { msg = 'Ajax request aborted.';
			} else { msg = 'Uncaught Error.\n' + jqXHR.responseText; }
			alert(msg);
		},
		success: rs=>{
			getData = rs; 
			$("div#showData").html(getData);
		}
	}); // .responseText; จะใช้ทำไม มี success เป็น call back อยุ๋แล้ว จะทำอะไรก็ทำในนั้น
}
$(document).ready(()=>{ // script ทำงาน หลังจาก Load document page เรียบร้อยแล้ว
	actionAjax();
	setInterval( actionAjax, 5000);
});
</script>
</head>
<body>
<div id="showData"></div>
<?php
// แยกไฟล์ เป็นไฟล์ ย่อยๆ จะได้ เข้าใจง่าย ไม่ยาวเกินไป แก้ไขได้เร็ว เพรา parser ะปิดได้หลาย page ไม่ต้องคอย scroll
include 'menu.php';
include 'content.php';
include 'xxxxxxx.php';
?>
</body>
</html>



ประวัติการแก้ไข
2021-02-03 08:41:21
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 08:39:38 By : Chaidhanan
 


 

No. 34



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ปล. จะใช้โค๊ดอะไรยังไง เปิด document มันหน่อยนะครับ อย่าคิดว่าตัวเอง เป็นอัจฉริยะ อ่านโค๊ดแล้วจะเข้าใจไปทุกโค๊ด
ถ้าไม่เข้าใจก็ต้องหาเปิดอ่าน มันไม่ได้มีแค่ สิ่งที่คุณต้องการ ณ เวลานั้น แต่มันจะมีสิ่งที่คุณควรรู้ เพื่ออนาคตอย่างอื่น อยู่ด้วย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 08:51:34 By : Chaidhanan
 


 

No. 35



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 32 เขียนโดย : ผ่านมา เมื่อวันที่ 2021-02-02 23:04:49
รายละเอียดของการตอบ ::
งงอีกแล้วครับ จะใส่ url อีกแล้วหรือครับ เมื่อคนอื่นแนะนำว่า ถ้าทำเป็น same page ปิด url แล้วผมปิด url แล้ว

$.ajax({
type: 'POST',
url: "seed.php",
data: {rev: 1},
dataType : 'json',
async: false,
success: function(data) {
$("#showData").html(data);
}
});

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 09:38:37 By : chawa-2011
 


 
@Tor

Same Page ก็ใส่ได้ (ใส่/ไม่ใส่ ก็มีค่าเท่ากัน)

มันใจเหรอว่า setInterval(function(){
//Loop สามล้านรอบ
}, interval); มันจะไม่ Timeout.

ถามว่า ควรใส่ไหม? เหมือนแม่คนหนึ่งมีลูกสาว 3 คน ลูกชาย 1 คน แม่จำลูกตัวเองได้เสมอ โดยไม่จำเป็นต้องตั้งชื่อ

ลูกสาวคนโตอายุ 12 ปี (อีหล้า)
ลูกชายคนกลาง อายุ 8 ปี (บักหำ)

ลูกสาวคนโต : หนูอายุ พึ่งจะ สิบสอง เองนะค่ะ แม่
แม่ : เออ ข้าเห็นเอ็งพา ผัว เข้าบ้านมา 5 คนล่ะ อีห่าหล้า

ปล. กลับไปอ่าน #NO 31 ให้เข้าใจ สักแต่คิดว่าเข้าใจ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 10:19:11 By : ผ่านมา
 


 
Blazor03


ปล. ความรู้ไม่มีวันสิ้นสุด ตราบลมหายใจสุดท้าย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 10:37:25 By : ผ่านมา
 


 

@Tor


#NO 33 สำหรับเรา คือ ตำรา PHP ฉบับ สมบูรณ์ เลยเชียวแหละ
ดูดีดี คนที่สรุป PHP ออกมาได้อย่างนี้ ไม่ธรรมดาคน
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 10:53:44 By : ผ่านมา
 


 

No. 39



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 33 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-03 08:39:38
รายละเอียดของการตอบ ::
ขอบคุณครับ Chaidhanan
ทำตามสิ่งที่แนะนำแล้วครับ

<!-- ///////////////////// ใช้ bootstrap แต่ไม่มี bootstarp.js มันยังไงอยู่นะ หรือจะเล่นแค่ css ควบคุม event เอง ดีเสียอีก ถ้าเข้าใจ-->
ตอบ เปิด bootstrp.js มี อยู่ด้านล่างใน </body> และปิด slim.js / popper.js แล้ว ถ้าเปิด slim.js / popper.js จะขึ้น .ajax is not function ผ,เลยปิดไหมครับ

สิ่งที่ผมเรียกใช้ bootstrap แต่พี่ๆยังไม่เห็น ผมใช้ 2 ตัว
1.bootstrap.css
2.js ใน js มี bootstrp.js / slim.js / popper.js


ทำตามสิ่งที่แนะนำแล้วครับ
ผลลัพธ์ไม่แสดง ส่วนที่ต้องการนำไปแสดงแบบ realtime / echo date("Y-m-d H:i:s"); code ไม่ error
update ครับ id="showData" แสดงผล echo date("Y-m-d H:i:s"); แล้วครับ
ปัญหาต่อมา เวลาไม่ตรงกับปัจจุบันแก้ยังไงครับ ได้ค่านี้ 2021-02-03 05:19:53 และเวลา add ข้อมูลใหม่เข้าไปในระบบ db หน้า dashboard ข้อมูลไม่เปลี่ยนเลยครับผม ต้องกดrefreash ตลอดครับ
noerror1.PNG


code dashboardcms.php ครับ
Code (PHP)
<?php
require_once('connection.php');

if (isset($_POST['rev']) && $_POST['rev'] == 1) { //ปรับเปลี่ยนเป็น get/ post และ type
  echo "Dashboard : Load Time : " . date("Y-m-d H:i:s");
  //  echo date("Y-m-d H:i:s");
   exit;
}

?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
  
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
  <!-- เปิด bootstrp.js มี อยู่ด้านล่าง ก่อน </body> -->
  <!-- ปิด slim.js / popper.js แล้ว -->

  <script>
var getData;
function actionAjax () {
   //โค้ด ajax
	$.ajax({ 
		type: 'POST',
		data: {
			rev: 1, 
			at: (new Date()).getTime() 
		}, 
		
		error: (exception, jqXHR)=>{
		
			var msg = '';
			if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.';
			} else if (jqXHR.status === 404) { msg = 'Requested page not found. [404]';
			} else if (jqXHR.status === 500) { msg = 'Internal Server Error [500].';
			} else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.';
			} else if (exception === 'timeout') { msg = 'Time out error.';
			} else if (exception === 'abort') { msg = 'Ajax request aborted.';
			} else { msg = 'Uncaught Error.\n' + jqXHR.responseText; }
			alert(msg);
		},
		success: rs=>{
			getData = rs; 
			$("div#showData").html(getData);
		}
	});
}
$(document).ready(()=>{ 
	actionAjax();
	setInterval( actionAjax, 5000);
});
</script>
</head>

<body>

  <!-- start style -->
  <style>
    /* body {
      background-image: url('bg/bg.jpg');
      background-repeat: no-repeat;
      background-attachment: fixed;
      background-size: cover;
      background-size: 100% 100%;
    } */

    /* .container {
      max-width: 1300px;
    } */

    /* .bg-primary {
      background-color: #A4DCE9 !important;
      background-repeat: no-repeat;
      background-attachment: fixed;
      background-size: cover;
      background-size: 100% 100%;
    } */

    /* <<--------start card------>> */
    body {
      /* font-family: "Roboto", sans-serif;
      font-size: 15px; */
      /* color: #686c71; */
      font-weight: 400;
      background: #eff3f6;
      position: relative;
    }

    table,
    td,
    th {
      border: 0px solid green;

    }

    th {
      /* background-color: green; */
      color: green;
    }

    /* <<--------เว้นช่องระหว่าง card------>> */
    .card {
      border-radius: 2px;
      box-shadow: 0 0 0 1px #e2e5e8;
      border: none;
      margin-bottom: 30px;
      transition: all 0.5s ease-in-out;
    }

    /* <<--------กำหนด font h3------>> */
    /* h3 {
            font-size: 24px;
        } */

    /* <<--------ขนาด font h3------>> */
    .h3,
    h3 {
      font-size: 1.75rem;
    }

    /* <<--------site font h3------>> */
    h3 {
      display: block;
      /* font-size: 1.17em; */
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0px;
      margin-inline-end: 0px;
      font-weight: bold;

    }

    /* <<--------กำหนดขนาด icon------>> */
    .f-36 {
      font-size: 50px;
    }

    /* <<--------ขนาดความสูง card------>> */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin-top: 0;
      margin-bottom: .1rem;
    }

    /* <<--------จัดcard 20px hight/ 25px ขยับtext------>> */
    .card .card-block,
    .card .card-body {
      padding: 20px 25px;
    }

    /* <<--------เส้นแบ่งครึ่งแนวตั้ง footer ------>> */
    .card-social .card-active>div+div {
      border-left: 1px solid #e2e5e8;
    }


    /* <<--------start box1 cp3------>> */
    /* <<--------color text totalpc------>> */
    .text-c-green {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon------>> */
    .text-Info {
      color: #58C8AC !important;
    }


    /* <<--------start box2 tara------>> */
    /* <<--------color text totalpc------>> */
    .text-c-yellow {
      color: #19BCBF;

    }

    /* <<--------color text red footer------>> */
    .text-c-red {
      color: #FF425C;

    }

    /* <<--------กำหนดสี icon------>> */
    .text-danger {
      color: #58C8AC !important;
    }


    /* <<--------start box3 wfh------>> */
    /* <<--------color text totalpc------>> */
    .text-c-blue {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon ------>> */
    .text-primary {
      color: #58C8AC !important;
    }

    /* <<--------สีพื้นหลัง card cp3------>> */
    .bg-warning,
    .bg-warning>a {
      color: #fff !important;
      background-color: #92AAC7 !important;
    }

    /* <<--------สีพื้นหลัง card tara------>> */
    .bg-info,
    .bg-info>a {
      color: #fff !important;
      background-color: #B3DE81 !important;
    }

    /* <<--------สีพื้นหลัง card wfh------>> */
    .bg-danger,
    .bg-danger>a {
      color: #fff !important;
      background-color: #FCC875 !important;
    }
  </style>


  <nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase fixed-top">
    <a class="fas fa-desktop fa-2x" href="#"></a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link" href="index.php">Computer Management System<span class="sr-only">(current)</span></a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="dashboardcms.php">DashBoard</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="modalmasterpc.php">Master Pc</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="v_detail_pc.php">Detail Pc</a>
        </li>

        <li class="nav-item">
          <a class="nav-link" href="v_monitor_pc.php">Monitor Pc</a>
        </li>
      </ul>
    </div>
  </nav>
  <br>
  <br>

  <!-- start header -->
  <!-- <header class="masthead bg-primary"> -->
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/web analysic.png" alt="" width="72" height="72"> -->
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/logo dashboard.png"> -->
        <!-- <h2 class="display text-center text-uppercase">DashBoard Computer Management</h2> -->
        <br>
        <div id="showData"></div>
        <?php
        // echo "Load Time : ".date("Y-m-d H:i:s");
        // echo "Dashboard : Load Time : " . date("Y-m-d H:i:s");
        // $resultArray
        // echo json_encode($resultArray);

        ?>
        <hr>

        <!-----------------------------------start card cp3---------------------------------->
        <div class="row">
          <!-- sum total pc on-->
           <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where ip LIKE '10.183%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];

          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <?php echo $statuspc; ?></a> </h6>
                  </div>
                  <div class="col-6">
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                      <!-- <td><span class="text-c-red mb-0 "><?php echo $_arrname[$row['team']]; ?></td> -->
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          // or ip <> left( (@target_ip:=''), length(@target_ip) - LOCATE('.', REVERSE(@target_ip)) )
          
          $statuspc = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where ip LIKE '10.150%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
       
             $statuspc = $statuspc + $row['countstatus'];
        
          } ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
                        where location ='Tara park' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc; ?></h6>
                  </div>
                  <div class="col-6">
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- start card3 sum total pc on-->
          <!-- sum total pc on-->
          <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
                        where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where ip LIKE '192.168%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } 

        
          // $ip = 10.183;
          // $statuspc = 0;
          // $sql = "SELECT statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where statuspc = '2';";
          // $result2 = $mysqli->query($sql);
          // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
          //  if ($ip == $statuspc){
          //    $statuspc == $statuspc + $row['countstatus'];
          //  } 
          // } 
          ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
                        where location ='wfh' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc; ?></h6>
                  </div>
                  <div class="col-6">
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon  = $row6['pcon'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>
        

        <!-- <script src="js/slim.js"></script> -->
        <script src="js/popper.js"></script>
        <script src="js/bootstrap.js"></script>

</body>

</html>





ประวัติการแก้ไข
2021-02-03 11:11:51
2021-02-03 11:15:39
2021-02-03 11:17:04
2021-02-03 11:33:22
2021-02-03 11:36:13
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 10:56:06 By : chawa-2011
 


 

No. 40



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


Quote:
....๏ โค้ดนี้ท่านได้แต่..........ใดมา
วชิรเมตตา..........เขียนไว้
เอาแค่ผ่านอะนีฆา..........มีขาด มีเกิน
เรียงสัดส่วนมาให้..........แต่งแต้ม ตามควร

....๏ ธรณีนี่นี้..........ใครลอง ใครได้
เราบ่เป็นสองรอง..........บ่จ้าง
รู้ทันปราชญ์ขุนทอง..........มาใส่ งานจริง
ให้สนุกประยุกต์สร้าง..........อยู่ที่ พยายาม

ละครชีวิต @ ๓ ก.พ. ๖๔ ณ ๐๙.๑๐ - ๑๑.๑๙ น.

....๐ ๐ ๐ เอก โท..........๐ X (๐ ๐)
๐ เอก ๐ ๐ X..........เอก โท
๐ ๐ เอก ๐ X..........๐ เอก (๐ ๐)
๐ เอก ๐ ๐ โท..........เอก โท (๐ X)



Quote:
พระแสนเมือง: ศรีเอยพระเจ้าฮื่อ ปางใด
ศรีปราชญ์: ฮื่อเมื่อเสด็จไป ป่าแก้ว
พระแสนเมือง: รังสีบ่สดใส สักหยาด
ศรีปราชญ์: ดำแต่นอกในแผ้ว ผ่องเนื้อนพคุณ



ประวัติการแก้ไข
2021-02-03 11:28:45
2021-02-03 11:29:42
2021-02-03 11:31:55
2021-02-03 11:33:10
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 11:21:37 By : lakornworld
 


 
@ละครชีวิต

อันใบตองพันห่อปลาร้าได้ ฉันใด
จิตมนุษย์นั่นไซร์ยากแท้ หยั่งถึง
สะแลงฟ้าบ่งบอกถึง จริงแท้ สูงส่ง
สะแลงดินบ่งบอกถึง ที่แท้ ตนเอง

ลูกศิษย์ท่าน อังคาร กัลยาณพงค์
เวลา : ลิบลิบ ไกลโพ้น เลยเส้นขอบฟ้านั่น
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 12:51:32 By : ผ่านมา
 


 

No. 42



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


เวลาไม่ตรง กับปัจจุบัน เพราะไม่ได้เซท TimeZone

Code (PHP)
<?php // ไว้ต้นไฟล์ เป็น Temporary timezone
date_default_timezone_set('Asia/Bangkok');


หรืออยากจะเซทตลอด เลย ให้ไปเซทใน php.ini

แต่แนะนำ ใช้ แบบ temporary มัน dynamic คล่องตัว ไม่ต้องสนว่า จะมีใครใช้ timezone อื่นอีกไหม

ส่วนหน้า page ไม่เปลี่ยนแปลง เพราะไม่ได้ไปเปลี่ยนค่ามัน ก็ต้องไล่เปลี่ยนไปเป็นส่วนๆ
object ไหนจะให้เปลี่ยนก็ต้องเขียนโค๊ดมาเปลี่ยนเท่านั้นเอง
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 12:59:19 By : Chaidhanan
 


 
คิดว่า เอาอยู่ JavaScript/Jquery บน Blazor Web Assembly

แจ่มแมวจริงฯ Blazor (พอฯกับ Angular2021/Vue2021/etc...)

Blazor04
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 13:28:19 By : ผ่านมา
 


 
File Index.html
Code (JavaScript)
[js]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>BlazorApp4</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
<link href="BlazorApp4.styles.css" rel="stylesheet" />
<link href="manifest.json" rel="manifest" />
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
</head>
<body>
<div id="app">Loading...</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 13:58:21 By : ผ่านมา
 


 
File demo.js

Code (JavaScript)
export function TestDataTablesAdd(table) {
    $(document).ready(function () {
        $(table).DataTable();
    });
}

export function TestDataTablesRemove(table) {
    $(document).ready(function () {
        $(table).DataTable().destroy();
        // Removes the datatable wrapper from the dom.
        var elem = document.querySelector(table + '_wrapper');
        elem.parentNode.removeChild(elem);
    });
}

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 14:00:26 By : ผ่านมา
 


 
File Index.razor

Code (C#)
@page "/"

@inject IJSRuntime JSRuntime
@implements IAsyncDisposable
@inject HttpClient Http

<h1>Hello, world!</h1>

<div class="alert alert-warning" role="alert">
    Before authentication will function correctly, you must configure your provider details in <code>Program.cs</code>
</div>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />

<div class="alert alert-warning" role="alert">
    Fucker JavaScript/Jquery in Blazor Web Assembly without <code>@("<script src='YouPath/js/Fucker.js'></script>")</code>
</div>

@if (forecasts == null) {
    <p><em>Loading...</em></p>
}
else {
    <table class="display" id="example">
        <thead>
            <tr>
                <th>Date</th>
                <th>Temp. (C)</th>
                <th>Temp. (F)</th>
                <th>Summary</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var forecast in forecasts) {
                <tr>
                    <td>@forecast.Date.ToShortDateString()</td>
                    <td>@forecast.TemperatureC</td>
                    <td>@forecast.TemperatureF</td>
                    <td>@forecast.Summary</td>
                </tr>
            }
        </tbody>
    </table>
}

@code {
    [Parameter]
    public bool Searchable { get; set; }

    private string name;
    private string retValue;
    // Load the module and keep a reference to it
    // You need to use .AsTask() to convert the ValueTask to Task as it may be awaited multiple times
    private Task<IJSObjectReference> _module;
    private Task<IJSObjectReference> Module => _module ??= JSRuntime.InvokeAsync<IJSObjectReference>("import", "./js/demo.js").AsTask();

    public async ValueTask DisposeAsync() {
        if (_module != null) {
            var module = await _module;
            await module.InvokeVoidAsync("TestDataTablesRemove", "#example"); // เปลี่ยนหน้าแล้ว มันยังค้างอยู่ใน DOM
            await module.DisposeAsync();
        }
    }
    protected override async Task OnInitializedAsync() {
        var module = await Module;
        forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
        await module.InvokeVoidAsync("TestDataTablesAdd", "#example");
    }

    private WeatherForecast[] forecasts;
    private class WeatherForecast
    {
        public DateTime Date { get; set; }

        public int TemperatureC { get; set; }

        public string Summary { get; set; }

        public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
    }
}

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 14:01:33 By : ผ่านมา
 


 
File Index.html

Code (C#)
[cs]<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>BlazorApp4</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
<link href="BlazorApp4.styles.css" rel="stylesheet" />
<link href="manifest.json" rel="manifest" />
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
</head>
<body>
<div id="app">Loading...</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 14:03:20 By : ผ่านมา
 


 
File Index.html (วางไม่ได้ว่ะเฮ้ย)

Code
[coding]<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>BlazorApp4</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
<link href="BlazorApp4.styles.css" rel="stylesheet" />
<link href="manifest.json" rel="manifest" />
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
</head>
<body>
<div id="app">Loading...</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 14:04:13 By : ผ่านมา
 


 
วาง File Index.html ไม่ได้ว่ะ งงติ็บ
(แลกเปลี่ยนกับ #NO 33)

Blazor05
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 14:06:47 By : ผ่านมา
 


 

No. 50



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 42 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-03 12:59:19
รายละเอียดของการตอบ ::
ขอบคุณครับ

ส่วนหน้า page ไม่เปลี่ยนแปลง เพราะไม่ได้ไปเปลี่ยนค่ามัน ก็ต้องไล่เปลี่ยนไปเป็นส่วนๆ
object ไหนจะให้เปลี่ยนก็ต้องเขียนโค๊ดมาเปลี่ยนเท่านั้นเอง
ตอบ เขียนโค้ดเพิ่มอยู่ใน ajax ถูกไหมครับ จาก code บอกว่า ใช้ ajax ด้วย jQuery ดึงข้อมูลจากฐานข้อมูล แบบนี้จะเขียนโค้ดยังไงต่อครับ หรือเขียนแบบนี้โดยการใส่ url dashboardcms.php same page ให้ ajax ไปดึงข้อมูลจากหน้า dashboardcms.php

หรือแบบนี้ครับ ใส่ code php ใน success
Code (PHP)
<script>
var getData;
function actionAjax () {
   //โค้ด ajax
	$.ajax({ 
		type: 'POST',
		data: {
			rev: 1, 
			at: (new Date()).getTime() 
		}, 
		
		error: (exception, jqXHR)=>{
		
			var msg = '';
			if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.';
			} else if (jqXHR.status === 404) { msg = 'Requested page not found. [404]';
			} else if (jqXHR.status === 500) { msg = 'Internal Server Error [500].';
			} else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.';
			} else if (exception === 'timeout') { msg = 'Time out error.';
			} else if (exception === 'abort') { msg = 'Ajax request aborted.';
			} else { msg = 'Uncaught Error.\n' + jqXHR.responseText; }
			alert(msg);
		},
		success: rs=>{
			getData = rs; 
			$("div#showData").html(getData);
                        <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where ip LIKE '10.183%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } ?>
		}
	});
}
$(document).ready(()=>{ 
	actionAjax();
	setInterval( actionAjax, 5000);
});
</script>




ประวัติการแก้ไข
2021-02-03 15:21:20
2021-02-03 15:48:58
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 15:19:33 By : chawa-2011
 


 

No. 51



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


เห็นคำถาม สุดท้ายแล้ว บ่งบอกให้รู้ว่า ยังไม่เข้าใจว่า php ทำงานยังไง เลย

สิ่งที่ต้องรู้ php ทำงานฝั่ง server มีหน้าที่ จัดการข้อมูล คำนวณ แล้วนำ result ที่ได้ มาส่งให้ ฝั่ง client ที่ร้องขอข้อมูลมา
โดยข้อมูลที่ ส่งให้กับ client สามารถอยู่ในรูปแบบต่างๆ ตามความต้องการได้
เช่น
1 plain text (content-type: application/text) ก็คือ text ธรรมดา "สวัสีดครับ"
2 html(content-type: application/html)
3 image binary ( content-type: image/xxxx)
ฯลฯ
ซึ่งต้องเข้าใจว่า ส่วนที่เป็น result พวกนี้ ถูกคำนวณแล้ว ส่วนที่เป็นโค๊ด php จะหายไป ไม่ได้ ปรากฏให้เห็นในข้อมูลที่ส่งไปอีกเลย
เช่น
<?php echo "1234"; ?>
สิ่งที่ client ได้รับคือ
1234
ไม่ได้มีส่วนของโค๊ด php ติดไปด้วยเลย
ดังนั้น อย่าคิดใส่การคำนวณ ใน โค๊ด javascript ด้วย โค๊ด php จากข้อมูล javascript บนฝั่ง client
(55555 งงหรือเปล่า 5555 พิมพ์เองชักงงเอง)
//---------------------------------------------------------
ที่นี้มาดูตัวอย่างจากสิ่งที่ต้องการ ซึ่งไม่ใช่แค่ date อย่างเดียวแล้ว แต่เป็นข้อมูลอื่นๆ ด้วย

ต้อง คิวรี่ และส่งค่า และ รับ มาจากการใช้ ajax ด้วย
ส่วนที่ 1 ส่วนของ php ที่รับ ajax request
Code (PHP)
if (isset($_POST['rev']) && $_POST['rev'] == 1) {  
	$d = 'Dashboard : Load Time : ' . date("Y-m-d H:i:s");
	$totalpcon = 0;
	$sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily where location ='cp3' and timestamp = CURRENT_DATE group by location ;";
	$result1 = $mysqli->query($sql1);
	while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
		$totalpcon = $totalpcon + $row['totalpcon'];
	}
	// --------statuspc--------
	$statuspc = 0;
	$sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_detail_pc where ip LIKE '10.183%' and statuspc = '2';";
	$result2 = $mysqli->query($sql);
	while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
		$statuspc = $statuspc + $row['countstatus'];
	}
	echo json_encode(['d'=>$d, 'totalpcon'=>$totalpcon, 'statuspc'=>$statuspc]);
	exit;
}


ส่วนที่ 2 javascript การส่ง ajax request
Code (JavaScript)
function actionAjax () {
	$.ajax({ 
		type: 'POST',
		data: { rev: 1, at: (new Date()).getTime()}, 
		dataType: 'json', // เปลี่ยนการรับค่าจาก text ธรรมดาเป็น json object
		error: (jqXHR, exception)=>{
			var msg = '';
			if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.';
			} else if (jqXHR.status === 404) { msg = 'Requested page not found. [404]';
			} else if (jqXHR.status === 500) { msg = 'Internal Server Error [500].';
			} else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.';
			} else if (exception === 'timeout') { msg = 'Time out error.';
			} else if (exception === 'abort') { msg = 'Ajax request aborted.';
			} else { msg = 'Uncaught Error.\n' + jqXHR.responseText; }
			alert(msg);
		},
		success: rs=>{
			$("#showData").html(rs.d);
			$('#totalpcon').html(rs.totalpcon);
			$('#statuspc').html(rs.statuspc);
		}
	});
}
$(document).ready(()=>{ 
	actionAjax();
	setInterval( actionAjax, 5000);
});

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-03 16:26:18 By : Chaidhanan
 


 

No. 52



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 51 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-03 16:26:18
รายละเอียดของการตอบ ::
ขอบคุณครับ
ต้อง คิวรี่ และส่งค่า และ รับ มาจากการใช้ ajax ด้วย
ส่วนที่ 1 ส่วนของ php ที่รับ ajax request

ตรงส่วนที่ 1 ผมมีคิวรี่มากกว่า 2 ตัวนี้ คือ totalpcon, statuspc และมีคิวรีที่ยังไม่ได้เอาไปใส่ครับ เพราะหน้า dashboardcms.php ผมมีการคิวรี่เยอะอยู่ครับ ถ้าจะเพิ่ม เอาคิวรี่ทั้งหมดมาต่อๆกัน และใช้รูปแบบเดิมใช่เปล่าครับ

1.error ส่วนนี้ครับ echo json_encode ต้องโหลดอะไรเพิ่มครับ หรือไลบารี่ผมไม่มี หรือ echo json_encode ไม่ใช้ได้หรือเปล่าครับ
00

2.ทำไหมแสดงผลลัพธ์แบบนี้ครับ ตรง Dashboard : Load Time ครับ เพราะว่าคิวรี่ที่อยู่ใน card ผมคิวรี่มาหมดแล้วครับ
ผลลัพ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 09:51:26 By : chawa-2011
 


 

No. 53



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


วิเคราะห์โค๊ดหน่อยครับ ผมก็อธิบายไว้แล้ว มีการเพิ่มเติม รูปแบบการส่ง ajax กำหนดรูปแบบของ ข้อมูลที่ส่งกลับมา
คือ dataType:'่json' คอมเม้นท์ผมก็แจงไว้ให้แล้ว อ่านและวิเคราะห์บ้างครับ

ปล. ส่วนที่เป็นเส้นหยักๆ มันบอกว่าไวยกรณ์ผิด ซึ่งน่าจะเป็นรุ่นของ parser(program editor) เก่าเกินไป ไม่รู้จักรูปแบบการเขียนใหม่ๆ
แต่รูปแบบมันถูกแล้ว ผมใช้บ่อยๆ 55555

ปล.อีกที รูปแบบเก่า echo json_encode(array( 'd'=>$d,..... ));


ประวัติการแก้ไข
2021-02-04 10:44:05
2021-02-04 10:58:39
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 10:40:24 By : Chaidhanan
 


 

No. 54



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ปล. แนะนำโปรแกรมช่วยการเขียนโปรแกรม netbean 12 ครับ ฟรี เก่ง
ใหญ่เทอะทะหน่อย เพราะมันอัดแน่นไปด้วยเครื่องมือช่วยเหลือทำให้เข้าใจ โค๊ด ไวยกรณ์ ได้เร็วขึ้น
แต่ถ้าเก่งแล้วจำโค๊ด ไวยกรณ์ได้ขึ้นใจแล้ว แนะนำ notepad++

ผมใช้ 2 ตัวนี้ ใช้ประจำก็ notepad++ เล็กมี autocomplete ให้ ขาดอย่างเดียวการหา error
ถ้าหา error ไม่เจอจริงๆ ก็จะใช้ netbean ช่วย
netbean ไม่ต้องปรับแต่งอะไร เปิดปุ๊บมันแจ้ง error ออกมาเพียบเลย 5555
โดยเฉพาะตัวแปรพิมพ์ตกพิมพ์เกินนี่ตัวดี ช่วยได้เยอะ หาเท่าไหร่ก็ไม่เจอ
ตาเปล่ามันวิเคราะห์ไม่ได้ คิดว่าเหมือนกันแต่จริงๆ มันไม่เหมือน
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 10:54:59 By : Chaidhanan
 


 
Code (PHP)
 if (X) {
} else if (Y) {
}




Code (JavaScript)
	$.ajax({ 
		type: 'POST',
		data: { rev: 1, at: (new Date()).getTime()}, 
		dataType: 'json', // เปลี่ยนการรับค่าจาก text ธรรมดาเป็น json object
		error: (jqXHR, exception)=>{
			var msg = '';
			if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.';
			} else if (jqXHR.status === 404) { msg = 'Requested page not found. [404]';
			} else if (jqXHR.status === 500) { msg = 'Internal Server Error [500].';
			} else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.';
			} else if (exception === 'timeout') { msg = 'Time out error.';
			} else if (exception === 'abort') { msg = 'Ajax request aborted.';
			} else { msg = 'Uncaught Error.\n' + jqXHR.responseText; }
			alert(msg);
		},
		success: rs=>{
			$("#showData").html(rs.d);
			$('#totalpcon').html(rs.totalpcon);
			$('#statuspc').html(rs.statuspc);
		}
	});
	$.ajax({ 
		type: 'POST',
		data: { rev: 69, at: "Ass"}, 
		dataType: 'json', // เปลี่ยนการรับค่าจาก text ธรรมดาเป็น json object
		error: (jqXHR, exception)=>{
			var msg = '';
			if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.';
			} else if (jqXHR.status === 404) { msg = 'Requested page not found. [404]';
			} else if (jqXHR.status === 500) { msg = 'Internal Server Error [500].';
			} else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.';
			} else if (exception === 'timeout') { msg = 'Time out error.';
			} else if (exception === 'abort') { msg = 'Ajax request aborted.';
			} else { msg = 'Uncaught Error.\n' + jqXHR.responseText; }
			alert(msg);
		},
		success: rs=>{
			$("#showData69").html(rs.XXX);
			$('#totalpcon69').html(rs.XXX);
			$('#statuspc69').html(rs.XXX);
		}
	});

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 11:22:10 By : ผ่านมา
 


 
Code (JavaScript)
async function actionAjaxAsync() {
    try {
        const getData1 = await $.ajax();     
        const getData2 = await $.ajax();
        const getData3 = await $.ajax();
        //Write less DO MORE...
        if (getData1) { };
        if (getData2) { };
        if (getData3) { };
    } catch (error) {
        alert(error);
    }
}
// Call Function actionAjaxAsync
actionAjaxAsync();


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 11:41:34 By : ผ่านมา
 


 
เราใช้ Visual Studio 2019 (Community Free forever)
--- เหตุผลที่ใช้ 1. ฟรี (ไม่มีเงินซื้อ)
--- เหตุผลที่ใช้ 2. อยากได้อะไร กดปุ่ม Next (มันทำให้หมดเลย)


ปล. มีบ้างที่ใช้ VSCode (ลูกเมียน้อย)
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 12:00:34 By : ผ่านมา
 


 

No. 58



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


โปรแกรมผมก็ใช้ Netbeans เป็นหลัก
มีดีตรงมี history ให้ด้วย คล้ายๆมี git ในตัว. สมัยก่อนตอนทำงานที่ออฟฟิศ เซฟงานแล้วไฟดับ ทั้งเครื่องผมเครื่องน้องที่ทำงาน ไฟล์หายเกลี้ยง เหลือเพียงความว่างเปล่า. โชคดีของผมใช้ Netbeans มันเลยเปิด history ย้อนกลับมาได้ ส่วนของน้องคนนั้น ต้อง ftp ไปเอาลงมาแก้อีกที เขียนโค้ดใหม่หมด

นอกนั้นก็ใช้ VS Code, Notepad++, Eclipse
ลงไว้หลายตัว เพราะบางทีเปิดโปรเจ็คอื่นขึ้นมาดูโค้ดที่เคยเขียนไว้มันง่ายกว่าเปิดในโปรแกรมเดียวกันทั้งหมด.

ว่าด้วยเครื่องมือตรวจสอบโค้ด มันมีชุดคำสั่งชุดหนึ่งซึ่งเป็นประโยชน์มาก ใช้ตรวจสไตล์การเขียนได้, ใช้ตรวจความเข้ากันได้ของรุ่น php ที่กำหนดก็ได้ เช่น กำหนดว่าจะต้องอยู่ใน php 7.3-7.4 ถ้ามี 5.6 ที่ deprecated/removed เสร่อมามันก็ฟ้อง อะไรแบบนี้, ใช้ตรวจความครอบคลุมของโค้ดก็ได้ เช่นประกาศตัวแปรไว้สะเปะสะปะเลอะเทอะไปหมด ตัวไหนไม่ใช้มันจะเตือนให้เราได้.
นั่นคือ PHP CodeSniffer
ใช้คู่กันกับ PHP Unit test มีประโยชน์อย่างมาก... เอาไว้ตรวจโค้ดก่อน commit หรือเผยแพร่ กันบั๊กที่ไม่ได้ตั้งใจ


ประวัติการแก้ไข
2021-02-04 13:34:22
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 13:32:39 By : mr.v
 


 

No. 59



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 53 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-04 10:40:24
รายละเอียดของการตอบ ::
ขอบคุณครับ
แก้ไขแล้วครับ ตอนเวลาที่ add ข้อมูลเข้าไปใน database ครับ ทำไมหน้า dashboardcms.php ไม่ realtime ครับ ผมต้อง refresh ตลอดครับ





ประวัติการแก้ไข
2021-02-04 14:56:35
2021-02-04 14:57:31
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 13:40:59 By : chawa-2011
 


 
ไม่ง่ายที่คิดจะเริ่มทำอะไร ของเดิมมันก็ดีอยู่แล้ว ค้ำคออยู่
เอา Source Code ชุดนี้ไปวิ่งบน Blazor

ทำได้สักแต่แค่ว่า ทำได้
เข้าใจสักแต่ว่า เข้าใจ
ทำไม่ได้สักแค่ว่า ทำไม่ได้
ไม่เข้าใจสักแค่ว่า ไม่เข้าใจ
...
...
...
Code (JavaScript)

(function (factory) {
    "use strict";
    if (typeof define === 'function' && define.amd) {
        // AMD
        define(['jquery'], function ($) {
            return factory($, window, document);
        });
    }
    else if (typeof exports === 'object') {
        // CommonJS
        module.exports = function (root, $) {
            if (!root) {
                root = window;
            }
            if (!$) {
                $ = typeof window !== 'undefined' ?
                    require('jquery') :
                    require('jquery')(root);
            }
            return factory($, root, root.document);
        };
    }
    else {
        // UMD/Browser
        factory(jQuery, window, document);
    }
}
    (function ($, window, document) {
        $.fn.dataTable.render.FuckerDate = function () {
            return function (data, type, row) {
                if (type === 'display') {
                    let str = Fucker.Date.JsonDate2String(data); // cast jsondate to real string date
                    return str;
                }
                return data; // Search, order and type can use the original data
            };
        };
        $.fn.dataTable.render.FuckerNumber = function () {
            return function (data, type, row) {
                if (type === 'display') {
                    let str = accounting.formatNumber(data, DECIMAL_PLACE_PRICE); //DECIMAL_PLACE_PRICE อ่านมาจากฐานข้อมูล ตาราง Fuck your mother
                    return str;
                }
                return data; // Search, order and type can use the original data
            };
        };
    }));

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 14:16:37 By : ผ่านมา
 


 

No. 61



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 59 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-02-04 13:40:59
รายละเอียดของการตอบ ::
55555 ถามมาแบบนี้ จะตอบได้ไหมล่ะครับเนี่ย


ที่บ้านผมตอนนี้ไม่รู้เป็นไร ไฟดับ บอกผมที่ทำไมไฟดับ 55555
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 14:52:12 By : Chaidhanan
 


 

No. 62



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 61 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-04 14:52:12
รายละเอียดของการตอบ ::
update ครับ
เริ่มเข้าใจแล้วครับ ต้อง show id ที่ต้องการแสดงด้วย ขออภัยที่ผมเข้าใจยากไปครับ

show id ที่ต้องการแล้ว realtime ไปนิดแล้วครับ แต่ตรงส่วนนี้ไม่ loop และมาแต่ทีม support ครับ
sup

แก้ต่อยังไงครับพี่ๆ
ส่วนที่ 1 ส่วนของ php ที่รับ ajax request ผมก็ไม่ได้เปิด-ปิด php ใส่ตามที่พี่ Chaidhanan แนะนำครับ
สิ่งที่อยู่นอกตารางผมทำให้ realtime ได้ได้แค่ card location cp3 ครับ ยังไม่ได้รวมคิวรี่ card location tara,wfh
แต่ในตารางนี่ดิ มันไม่ loop ครับ



ประวัติการแก้ไข
2021-02-04 15:10:04
2021-02-04 15:16:55
2021-02-04 16:05:17
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 14:59:30 By : chawa-2011
 


 

No. 63



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ยังไม่เลิกเอาส่วนที่เป็น text มาแสดงเป็นภาพ อีกเหรอครับ

และอะไรที่แก้ไขแล้ว ก็เอามาดูด้วย จะได้รู้ว่าแก้ถูก
เวลาครูบอกให้แก้งาน ตอนส่งงานที่แก้ส่งด้วยปากเปล่าหรือเปล่า
บอกครูว่า ผมแก้แล้วครับ ครูเขาจะให้ผ่านไหม

และไอ้ card location ใช้ class อะไรเขียน วฺิธีแก้ไข ก็ต้องไปอ่าน document ของ เครื่องมือที่เราใช้ให้ดี
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-04 17:57:25 By : Chaidhanan
 


 

No. 64



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 63 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-04 17:57:25
รายละเอียดของการตอบ ::
ขอบคุณครับ
ยังไม่เลิกเอาส่วนที่เป็น text มาแสดงเป็นภาพ อีกเหรอครับ ตอบ ให้เอา text มาแสดงเป็นภาพหรอครับ

ตอนนี้ที่ realtime ได้ จะอยู่นอกตารางครับ คิวรี่ของ php ที่รับ ajax request
ภาพที่ 1
นอก

ในตาราง เอาไปคิวรี่แล้วไม่ loop ผมย้อนกลับมาเริ่มใหม่ครับ (เอาคิวรี่ที่ php ที่รับ ajax request ออกแล้ว เพราะไม่ loop)
ภาพที่ 2
ใน

เกิด error เกิดจากอะไรหรอครับ และ maximum error 30 second
ภาพที่ 3
un

ภาพที่ 4
err

code dashboardcms.php
Code (PHP)
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');

if (isset($_POST['rev']) && $_POST['rev'] == 1) { //ปรับเปลี่ยนเป็น get/ post และ type
  // echo "Dashboard : Load Time : " . date("Y-m-d H:i:s");
  $d = 'Dashboard : Load Time : ' . date("Y-m-d H:i:s");
  // cp3
  // sum total pc on
	$totalpcon = 0;
	$sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily where location ='cp3' and timestamp = CURRENT_DATE group by location ;";
	$result1 = $mysqli->query($sql1);
	while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
		$totalpcon = $totalpcon + $row['totalpcon'];
	}
	// --------statuspc--------
	$statuspc = 0;
	$sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where ip LIKE '10.183%' and statuspc = '2';";
	$result2 = $mysqli->query($sql);
	while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
		$statuspc = $statuspc + $row['countstatus'];
  }
  // -------count total pc ------->
  $total = 0;
  $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
  where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
  group by team ;";

  $result1 = $mysqli->query($sql1);
  while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
    $total = $total + $row['countpc'];
  }  

  // tara
  $totalpcon1 = 0;
  $sql1 = "SELECT location,sum(total) as totalpcon1 FROM monitorpc.v_check_pc_daily 
  where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

  $result1 = $mysqli->query($sql1);
  while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
    $totalpcon1 = $totalpcon1 + $row['totalpcon1'];
  }

  $statuspc1 = 0;
  $sql = "SELECT statuspc, count(ip) as countstatus1 FROM monitorpc.tbl_new_pc where ip LIKE '10.150%'
  and statuspc = '2';";
  $result2 = $mysqli->query($sql);
  while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {      
     $statuspc1 = $statuspc1 + $row['countstatus1'];        
  }

  $total1 = 0;
  $sql1 = "SELECT team,count(no) as countpc1 FROM monitorpc.master_pc
  where location ='Tara park' group by team ;";

  $result1 = $mysqli->query($sql1);
  while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
  $total1 = $total1 + $row['countpc1'];       
  }

  // wfh
  $totalpcon2 = 0;
  $sql1 = "SELECT location,sum(total) as totalpcon2 FROM monitorpc.v_check_pc_daily 
                where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

  $result1 = $mysqli->query($sql1);
  while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
    $totalpcon2 = $totalpcon2 + $row['totalpcon2'];
  } 

  $statuspc2 = 0;
  $sql = "SELECT statuspc, count(ip) as countstatus2 FROM monitorpc.tbl_new_pc where ip LIKE '192.168%'
  and statuspc = '2';";
  $result2 = $mysqli->query($sql);
  while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
    $statuspc2 = $statuspc2 + $row['countstatus2'];
  } 

  $total2 = 0;
  $sql1 = "SELECT team,count(no) as countpc2 FROM monitorpc.master_pc
  where location ='wfh' group by team ;";

  $result1 = $mysqli->query($sql1);
  while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
    $total2 = $total2 + $row['countpc2'];
  }

  echo json_encode(['d'=>$d,'totalpcon'=>$totalpcon, 'statuspc'=>$statuspc,'total'=>$total,
                            'totalpcon1'=>$totalpcon1 , 'statuspc1'=>$statuspc1 ,'total1'=>$total1,
                            'totalpcon2'=>$totalpcon2 , 'statuspc2'=>$statuspc2 ,'total2'=>$total2
                            ]);
   exit;
}

?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
  
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
  <!-- เปิด bootstrp.js มี อยู่ด้านล่าง ก่อน </body> -->
  <!-- ปิด slim.js / popper.js แล้ว -->

  <script>
var getData;
function actionAjax () {
   //โค้ด ajax
	$.ajax({ 
		type: 'POST',
		data: {
			rev: 1, 
			at: (new Date()).getTime() 
		}, 
		dataType: 'json',
		error: (exception, jqXHR)=>{
		
			var msg = '';
			if (jqXHR.status === 0) { msg = 'Not connect.\n Verify Network.';
			} else if (jqXHR.status === 404) { msg = 'Requested page not found. [404]';
			} else if (jqXHR.status === 500) { msg = 'Internal Server Error [500].';
			} else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.';
			} else if (exception === 'timeout') { msg = 'Time out error.';
			} else if (exception === 'abort') { msg = 'Ajax request aborted.';
			} else { msg = 'Uncaught Error.\n' + jqXHR.responseText; }
			alert(msg);
		},
		success: rs=>{
			getData = rs; 
      $("#showData").html(rs.d);
      $('#totalpcon').html(rs.totalpcon);
      $('#statuspc').html(rs.statuspc);
      $('#total').html(rs.total);

      // tara
      $('#totalpcon1').html(rs.totalpcon1);
      $('#statuspc1').html(rs.statuspc1);
      $('#total1').html(rs.total1);

      // wfh
      $('#totalpcon2').html(rs.totalpcon2);
      $('#statuspc2').html(rs.statuspc2);
      $('#total2').html(rs.total2);
		}
	});
}
$(document).ready(()=>{ 
	actionAjax();
	setInterval( actionAjax, 1000);
});
</script>
</head>

<body>

  <!-- start style -->
  <style>
    /* body {
      background-image: url('bg/bg.jpg');
      background-repeat: no-repeat;
      background-attachment: fixed;
      background-size: cover;
      background-size: 100% 100%;
    } */

    /* .container {
      max-width: 1300px;
    } */

    /* .bg-primary {
      background-color: #A4DCE9 !important;
      background-repeat: no-repeat;
      background-attachment: fixed;
      background-size: cover;
      background-size: 100% 100%;
    } */

    /* <<--------start card------>> */
    body {
      /* font-family: "Roboto", sans-serif;
      font-size: 15px; */
      /* color: #686c71; */
      font-weight: 400;
      background: #eff3f6;
      position: relative;
    }

    table,
    td,
    th {
      border: 0px solid green;

    }

    th {
      /* background-color: green; */
      color: green;
    }

    /* <<--------เว้นช่องระหว่าง card------>> */
    .card {
      border-radius: 2px;
      box-shadow: 0 0 0 1px #e2e5e8;
      border: none;
      margin-bottom: 30px;
      transition: all 0.5s ease-in-out;
    }

    /* <<--------กำหนด font h3------>> */
    /* h3 {
            font-size: 24px;
        } */

    /* <<--------ขนาด font h3------>> */
    .h3,
    h3 {
      font-size: 1.75rem;
    }

    /* <<--------site font h3------>> */
    h3 {
      display: block;
      /* font-size: 1.17em; */
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0px;
      margin-inline-end: 0px;
      font-weight: bold;

    }

    /* <<--------กำหนดขนาด icon------>> */
    .f-36 {
      font-size: 50px;
    }

    /* <<--------ขนาดความสูง card------>> */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin-top: 0;
      margin-bottom: .1rem;
    }

    /* <<--------จัดcard 20px hight/ 25px ขยับtext------>> */
    .card .card-block,
    .card .card-body {
      padding: 20px 25px;
    }

    /* <<--------เส้นแบ่งครึ่งแนวตั้ง footer ------>> */
    .card-social .card-active>div+div {
      border-left: 1px solid #e2e5e8;
    }


    /* <<--------start box1 cp3------>> */
    /* <<--------color text totalpc------>> */
    .text-c-green {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon------>> */
    .text-Info {
      color: #58C8AC !important;
    }


    /* <<--------start box2 tara------>> */
    /* <<--------color text totalpc------>> */
    .text-c-yellow {
      color: #19BCBF;

    }

    /* <<--------color text red footer------>> */
    .text-c-red {
      color: #FF425C;

    }

    /* <<--------กำหนดสี icon------>> */
    .text-danger {
      color: #58C8AC !important;
    }


    /* <<--------start box3 wfh------>> */
    /* <<--------color text totalpc------>> */
    .text-c-blue {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon ------>> */
    .text-primary {
      color: #58C8AC !important;
    }

    /* <<--------สีพื้นหลัง card cp3------>> */
    .bg-warning,
    .bg-warning>a {
      color: #fff !important;
      background-color: #92AAC7 !important;
    }

    /* <<--------สีพื้นหลัง card tara------>> */
    .bg-info,
    .bg-info>a {
      color: #fff !important;
      background-color: #B3DE81 !important;
    }

    /* <<--------สีพื้นหลัง card wfh------>> */
    .bg-danger,
    .bg-danger>a {
      color: #fff !important;
      background-color: #FCC875 !important;
    }
  </style>


  <nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase fixed-top">
    <a class="fas fa-desktop fa-2x" href="#"></a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link" href="index.php">Computer Management System<span class="sr-only">(current)</span></a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="dashboardcms.php">DashBoard</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="modalmasterpc.php">Master Pc</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="v_detail_pc.php">Detail Pc</a>
        </li>

        <li class="nav-item">
          <a class="nav-link" href="v_monitor_pc.php">Monitor Pc</a>
        </li>
      </ul>
    </div>
  </nav>
  <br>
  <br>

  <!-- start header -->
  <!-- <header class="masthead bg-primary"> -->
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/web analysic.png" alt="" width="72" height="72"> -->
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/logo dashboard.png"> -->
        <!-- <h2 class="display text-center text-uppercase">DashBoard Computer Management</h2> -->
        <br>
        <div id="showData"></div>
        
        <hr>

        <!-----------------------------------start card cp3---------------------------------->
        <div class="row">
          <!-- sum total pc on-->
           <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where ip LIKE '10.183%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];

          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>                    
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <?php echo $statuspc; ?></a> </h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <class id="statuspc"></a> </h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                 
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                      
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon1 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon1 FROM monitorpc.v_check_pc_daily 
          where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon1 = $totalpcon1 + $row['totalpcon1'];
          } ?>

          <!----------statuspc-------->
          <?php
          // or ip <> left( (@target_ip:=''), length(@target_ip) - LOCATE('.', REVERSE(@target_ip)) )
          
          $statuspc1 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus1 FROM monitorpc.tbl_new_pc where ip LIKE '10.150%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {      
             $statuspc1 = $statuspc1 + $row['countstatus1'];        
          } ?>

          <!-------count total pc ------->
          <?php
          $total1 = 0;
          $sql1 = "SELECT team,count(no) as countpc1 FROM monitorpc.master_pc
                        where location ='Tara park' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total1 = $total1 + $row['countpc1'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total1; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total1"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc1; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc1"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon1; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon1"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon2 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon2 FROM monitorpc.v_check_pc_daily 
                        where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon2 = $totalpcon2 + $row['totalpcon2'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc2 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus2 FROM monitorpc.tbl_new_pc where ip LIKE '192.168%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc2 = $statuspc2 + $row['countstatus2'];
          }  ?>

          <!-------count total pc ------->
          <?php
          $total2 = 0;
          $sql1 = "SELECT team,count(no) as countpc2 FROM monitorpc.master_pc
                        where location ='wfh' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total2 = $total2 + $row['countpc2'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total2; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total2"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc2; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc2"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon2; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon2"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon  = $row6['pcon'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>
            </div>

  
      <!-- ---------------------------------------------------------------------------------------------------------------->
      <hr>
      <h5 class="text-left">PC OFF</h5>
      <br>
      <!-----------------------------------start card cp3---------------------------------->
      <div class="row">
          <!-- sum total pc off-->
           <?php
          $totalpcoff = 0;
          $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp != CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>
      
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Off</th>
                    
                  </tr>
                </thead>

                <tbody>               

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                // <<-------------sum pc off opt1 2 3 support------->>
                    $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='Tara park' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
              
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc off opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

          
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='wfh' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <h5 class="text-muted ">Total PC Off <span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>
                
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc on opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                   
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>

        <!-- <script src="js/slim.js"></script> -->
        <script src="js/popper.js"></script>
        <script src="js/bootstrap.js"></script>

</body>

</html>





ประวัติการแก้ไข
2021-02-05 13:41:30
2021-02-05 13:44:18
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-05 13:21:08 By : chawa-2011
 


 

No. 65



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


มีเม้นท้ข้างบนเขาเตือนเรื่อง timeout ไว้แล้ว ไม่กระสาเลยนะครับ 55555

ข้อมูลที่เราทำ realtime ถ้าใช้ setInterval มันต้องคำนวณเวลาที่ส่งกลับมาด้วย

วิธีแก้ปัญหา ใช้ setTimeout แทน
ส่วน php เพิ่ม set_time_limit( 999 ); หน่วยเป็นวินาที กะระยะทำงาน ให้ดี

ปล. กรณี มีข้อมูลมาก ก็แยกส่วนการทำงานเป็น หลาย request ก็ได้

Code (JavaScript)
function req(prog_no, next_time){
   $.ajax({ url: 'xxxx', data: { rev: prog_no},
      ...,
      success: rs=>{
         switch(prog_no){
         case 1: ..... break;
         case 2: ..... break;
         case 3: ..... break;
         }
         setTimeout(()=>{ req_1(prog_no, next_time); }, next_time);
      }
   });
}
$(document).ready( ()=>{
   req(1, 50);
   req(2, 5000);
   req(3, 10000);
});

อาจกำหนด ระยะเวลาการโหลดครั้งต่อไปต่างกัน แล้วแต่ความสำคัญ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-05 14:10:34 By : Chaidhanan
 


 
เวลามันหายไปไหนหว่า?
หรือว่า ชีวิตคนเรามัน สั้นนัก ไปไม่ถึงหนทางนั้น

หลับหูหลับตาทำฯไป ค่อยมาแก้ไขคำ (กรองคำ/รองรับหลากหลายภาษา) ภายหลัง

GL09
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-05 14:54:52 By : ผ่านมา
 


 

No. 67



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 65 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-05 14:10:34
รายละเอียดของการตอบ ::
อยากใช้ setinterval เพราะชอบที่ให้มันทำงานๆไปเรื่อยๆครับ มีวิธีแก้ที่ไม่ใช้ setTimeout ไหมครับ
แก้โดย เปลี่ยนแบบนี้ได้ไหม setInterval( actionAjax, 10000); เปลี่ยนค่าตัวนี้ 10000
ถ้าเปลี่ยนเป็น setTimeout แทน รูปแบบ code ยังเหมือนเดิมเปล่าครับ

ดูรูปแบบ code ของพี่ ผมยังเรียบเรียงcode ไม่ถูกครับ



ประวัติการแก้ไข
2021-02-05 15:00:50
2021-02-05 15:21:04
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-05 14:56:49 By : chawa-2011
 


 
@Tor

ผมวาง HTML/Code/etc... แยกเป็นหมวดหมู่ (ผมคิดก่อนเขียน ผมคิดก่อนทำ)

Code (XML)
<div id="divList" class="mx-auto">
    <div class="card">
        <div class="card-header text-center bg-gray-100 tx-bold">
            <span id="spanListBack" data-toggle="tooltip" title="@Localizer["Back"]@Localizer["Go"]@Localizer["Previous"]" style="cursor:pointer; float:left;"><i data-feather="chevron-left"></i></span>
            <span id="spanListTitle">สมุดบัญชีและรายงานต่างฯ<i class="feather feather-more-horizontal wd-20 ht-20"></i></span>
        </div>
        <div class="card-body">
            @*<i class="fa fa-ellipsis-v"></i>*@
            <table id="tblGl_JVH" class="table" width="100%">
                <thead>
                    <tr>
                        <th class="wd-15p">@Localizer["ReportCode"]</th>
                        <th class="wd-30p">@Localizer["ReportDesc"]</th>
                        <th class="wd-30p">@Localizer["ReportDesc2"]</th>
                        <th class="wd-70 tx-center"><img src="~/img/file_new.gif" id="imgAddGLRpt" class="addItem imgButton" /></th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>
</div>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-05 15:11:11 By : ผ่านมา
 


 

No. 69



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


setIterval ทำไปเรื่อยๆ เครื่อง server ค้าง ก็ยังทำงานอยู่

setTimeout ตั้งเวลาใหม่ เมื่อทำเสร็จ

เปลี่ยนแปลงนิดหน่อย วิเคราะโค๊ดทีผมทำเป็นตัวอย่าง

แนะนำให้ใช้ setTimeout มันเปลี่ยนแปลงกำหนดค่าต่างๆ เป็น dynamic มากกว่า
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-05 18:09:40 By : Chaidhanan
 


 

No. 70



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


จะใช้ setInterval ก็ได้ แต่ว่าในกระบวนการของมันต้องตรวจสอบด้วย เช่นคุณ Chaidhanan ว่า ถ้ามันมีปัญหา ต้องสามารถสั่งหยุดหรือ clearInterval ได้ ไม่ใช่ทื่อออออทำไปเรื่อยไม่รู้เรื่องราวแล้วก็ไม่มีหยุด
อย่างถ้าใช้ setInterval ในการ ajax ping ทุกๆ request ต้องมีเวลาพอให้ server ส่งกลับก่อนที่มันจะสั่งทำงานรอบใหม่
และทุกๆ request ต้องตรวจว่าเมื่อมี response ที่ไม่พึงปรารถนา เช่น http 5xx, 4xx, 3xx อะไรก็ตาม แม้แต่ ajax timeout นานเกินไป มันจะต้องหยุดเป็น
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-05 18:42:47 By : mr.v
 


 
@ALL ทำได้ไม่แปลก ทำไม่ได้ซิแปลกและควรภาคภูมิใจ

ผมเห็นความพยายามของคุณ Tor ผมก็ดีใจและมีความสุขแล้ว เป็นความสุขที่ผมสำผัสได้
เป็นความสุขที่ไม่เหมือนใคร สุขและทุกข์ก็ไม่เหมือนใคร...

นี่อาจเป็นอีกทางเลือกหนึ่ง Select ครั้งเดียวและเอาข้อมูลมาให้ครบ

Code (XML)
/*SQL Server*/
DefaultConnection": "Server=xxxServer\\SQLEXPRESS2012; Database=xxxDB; User Id=sa; Password=xxx; MultipleActiveResultSets=true;",
    "IsEncrypt": false,

/*MySQL/MariaDB*/
"DefaultConnection": "Server=localhost;Port=3306;User Id=root;Password=xxx;Database=xxx;Allow User Variables=True",


SQL Server/MySQL/Oracle/etc... ไม่แตกต่างกัน

Code (SQL)
declare @xVar1 float;
set @xVar1 = (select 1.6996)
select 'xA' as xColumn1, 0.00 as xColumn2 union all
select 'xA', (select 14.69) union all
select 'xB', (select 55.96) union all
select 'xC', (select @xVar1)
;


ปล. เราเข้าใจ แต่เราไม่รู้จะอธิบายให้เข้าใจได้อย่างไร?
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-05 21:05:18 By : ผ่านมา
 


 
Store Procedure/Function และอื่นฯ บน RDBMS/NoSQL
มันก็แค่ ความทรงจำ ที่ไม่ค่อยจะดีนัก ลืมฯมันไปซะ เราก็ทุกข์น้อยลง
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-05 21:22:54 By : ผ่านมา
 


 

No. 73



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 65 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-05 14:10:34
รายละเอียดของการตอบ ::
ขอบคุณครับ
ผมแปลง code จาก setInterval เป็น settimeout ถูกหรือเปล่าครับ
Code (PHP)
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');

if (isset($_POST['rev']) && $_POST['rev'] == 1) { //ปรับเปลี่ยนเป็น get/ post และ type
  // echo "Dashboard : Load Time : " . date("Y-m-d H:i:s");
  echo 'Dashboard : Load Time : ' . date("Y-m-d H:i:s");
  
   exit;
}

?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
  
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
  <!-- เปิด bootstrp.js มี อยู่ด้านล่าง ก่อน </body> -->
  <!-- ปิด slim.js / popper.js แล้ว -->

  <script>
function req(prog_no, next_time){
   $.ajax({ url: 'ส่วนนี้ผมใส่อะไรหรอครับ', data: { rev: prog_no},
      
      success: rs=>{
         switch(prog_no){
         case 1:  // sum total pc on
                    $totalpcon = 0;
                    $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily where location ='cp3' and timestamp = CURRENT_DATE group by location ;";
                    $result1 = $mysqli->query($sql1);
                    while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
                        $totalpcon = $totalpcon + $row['totalpcon'];
                    }
        break; 
         case 2: // --------statuspc--------
                    $statuspc = 0;
                    $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where ip LIKE '10.183%' and statuspc = '2';";
                    $result2 = $mysqli->query($sql);
                    while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                        $statuspc = $statuspc + $row['countstatus'];
                }
        break;
         case 3: // -------count total pc ------->
                    $total = 0;
                    $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
                    where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
                    group by team ;";

                    $result1 = $mysqli->query($sql1);
                    while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
                        $total = $total + $row['countpc'];
                    }  
             break;
         }
         setTimeout(()=>{ req_1(prog_no, next_time); }, next_time);
      }
   });
}
$(document).ready( ()=>{
   req(1, 1000);
   req(2, 2000);
   req(3, 5000);
});
</script>
</head>

<body>
<div id="showData"></div>
</body>
</html>







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-07 00:37:22 By : chawa-2011
 


 

No. 74



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


เอา js มาปนกับ php มันแบบนั้นเลย?

แล้วมันจะทำงานได้มั้ย?

เคยทดลองรันดูมั้ยว่าผลมันเป็นยังไง? หรือว่าถามแล้วรอคำตอบอย่างเดียว?
คุณลองอ่านคห. 51 ให้เข้าใจแตกฉานซะก่อนดีกว่านะ ดูแล้วภาษาไทยก็ยังสื่อสารเหมือนจะไม่รู้เรื่องกันเท่าไหร่
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-07 00:45:43 By : mr.v
 


 

No. 75



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 51 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-03 16:26:18
รายละเอียดของการตอบ ::
ขึ้นไปดูความเห็นนี้ครับ ผมมีตัวอย่าง ให้แล้ว ขอให้วิเคราะห์หน่อยครับ เหตุผลเดียวกับ mr.v คห.74 ข้างบน


ปล.เอาเม้าส์คลิก ที่บันทัด สีฟ้า เลยครับ เป็นลิงคฺ์ ไปที่ คห.51

อันนี้สำคัญต้องรู้จัก เปิด browser แล้วไปยังโค๊ด javascript ที่เขียนแล้วมองดูว่า มันมีส่วนของ php ติดมาหรือไม่
เข้าใจตรงส่วนนี้ก่อน เมื่อมันหายไปแล้ว มันจะยังใช้ code php นั้นได้อีกไหม


ประวัติการแก้ไข
2021-02-07 08:39:21
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-07 08:35:54 By : Chaidhanan
 


 

No. 76



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 74 เขียนโดย : mr.v เมื่อวันที่ 2021-02-07 00:45:43
รายละเอียดของการตอบ ::
ผลลัพธ์ขึ้นแบบนี้ครับ Fatal error
: Maximum execution time of 30 seconds exceeded

ข้อมูล realtime ที่อยู่นอกตารางยังทำงานครับ และมีบางส้วนที่ข้อมูลมาไม่ครบในส่วน card pc off ครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-08 08:56:35 By : chawa-2011
 


 

No. 77



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 75 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-07 08:35:54
รายละเอียดของการตอบ ::
ผมวิเคราะห์และศึกษาอยู่ครับ แต่ผมจะเอา code จาก setInterval แปลง settimeout ได้อย่างไร สิ่งที่ผมแปลงผิด แต่ผมไปรัน code ยังทำงานที่อยู่นอกตารางครับ แต่มีบางส่วนที่ card pc off ไม่มา


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-08 09:08:34 By : chawa-2011
 


 

No. 78



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 76 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-02-08 08:56:35
รายละเอียดของการตอบ ::

ตอบความคิดเห็นที่ : 65 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-05 14:10:34
รายละเอียดของการตอบ ::
... อ่านความคิดเห็นนี้.......





ประวัติการแก้ไข
2021-02-08 10:33:04
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-08 10:31:56 By : Chaidhanan
 


 

No. 79



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


OP

Quote:
...ถ้าเรียนจากยอดสู่รากเกินกำลัง..........ใช้พลังไต่เต้าจากรากเหง้า
ดินสู่ฟ้าง่ายกว่าแถมคลายเหงา...............อย่าพึงเศร้าถอดใจก่อนได้มา


รากต้นมงคล
https://www.thaicreate.com/tutorial/ajax.html


ประวัติการแก้ไข
2021-02-08 19:21:17
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-08 19:02:33 By : lakornworld
 


 

No. 80



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 65 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-05 14:10:34
รายละเอียดของการตอบ ::
ที่ error เพราะกำหนดค่านี้หรือเปล่าครับ setInterval( actionAjax, 2000); หมายเหตุ พอผมกำหนด 1000 , 2000 ผ่านไป 5 นาทีมี error ถ้า setInterval มันต้องคำนวณเวลาที่ส่งกลับมา ผมแก้ไขโดยกำหนดเวลาเป็น 10 วิ/ 20 วิ แบบนี้ได้ไหมครับ

ตั้งคำถาม
1.ข้อมูลตัวเลขที่แสดงผลในตาราง ยังไม่ได้นำไปทำเป็น realtime แต่ทำไมมัน Fatal error
: Maximum execution time of 30 seconds exceeded on line xxx

2.ลองไปใช้ settimeout
ส่วน php เพิ่ม set_time_limit( 999 ); หน่วยเป็นวินาที

แบบนี้หรือไม่ ลองทำแบบผิดๆ ทำไป test ไป
Code (PHP)
//ส่วน php
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');

if (isset($_POST['rev']) && $_POST['rev'] == 1) { 
  //echo "Dashboard : Load Time : " . date("Y-m-d H:i:s");
    set_time_limit( 20000 ); // set_time_limit( 999 ); หน่วยวินาที
  $d = 'Dashboard : Load Time : ' . date("Y-m-d H:i:s");
 
 
   exit;
}

//ส่วน script
<script>
function req(prog_no, next_time){
   $.ajax({ url: '', data: { rev: prog_no},
      
      success: rs=>{
         switch(prog_no){
         case 1:  // sum total pc on
                    $totalpcon = 0;
                    $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily where location ='cp3' and timestamp = CURRENT_DATE group by location ;";
                    $result1 = $mysqli->query($sql1);
                    while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
                        $totalpcon = $totalpcon + $row['totalpcon'];
                    }
        break; 
         case 2: // --------statuspc--------
                    $statuspc = 0;
                    $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where ip LIKE '10.183%' and statuspc = '2';";
                    $result2 = $mysqli->query($sql);
                    while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                        $statuspc = $statuspc + $row['countstatus'];
                }
        break;
         case 3: // -------count total pc ------->
                    $total = 0;
                    $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
                    where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
                    group by team ;";

                    $result1 = $mysqli->query($sql1);
                    while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
                        $total = $total + $row['countpc'];
                    }  
             break;
            
         }
         setTimeout(()=>{ req_1,req_2,req_3(prog_no, next_time); }, next_time);
      }
   });
}
$(document).ready( ()=>{
   req(1, 1000);
   req(2, 2000);
   req(3, 5000);
});
</script>


ทำไม่ถูกเลย อ่านวิเคราะห์แล้วยังไม่เข้า

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-09 17:41:57 By : chawa-2011
 


 

No. 81



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


ข้างบนก็บอกอยู่แหมบๆว่าอย่าเอา php ไปปนกันกับ javascript

เอาแค่นี้ก่อน กลัวบอกมากจะไม่เข้าใจอีก
แค่นี้พอได้ไหม? ไม่ปนกันน่ะ php, js
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-09 19:33:00 By : mr.v
 


 

No. 82



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 80 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-02-09 17:41:57
รายละเอียดของการตอบ ::
โค๊ด จากคห 80 มันทำงานไม่ได้ เพราะมันเอา code php ไปใส่ในส่วนของ javascript (ajax function)

ทำความเข้าใจ โค๊ดข้างล่างหน่อย เว้นส่วนให้ปรับปรุงแก้ไขเอง
อ่าน comment ตัวสีเขียนด้วยล่ะ
Code (PHP)
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');

if (isset($_POST['rev']) && $_POST['rev'] == 1) { 
	//echo "Dashboard : Load Time : " . date("Y-m-d H:i:s");
	set_time_limit( 20000 ); // set_time_limit( 999 ); หน่วยวินาที
	/* ย้ายจาก javascript ajax function มาไว้ที่นี้  */
	switch( $_POST['rev'] ){
	case 1:
		echo 'Dashboard : Load Time : ' . date("Y-m-d H:i:s");
		// สำหรับ parameter rev = 1 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
		break;
	case 2:
		// สำหรับ parameter rev = 2 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
		break;
	case 3:
		// สำหรับ parameter rev = 3 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
		break;
	case 4:
		// สำหรับ parameter rev = 4 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
		break;
	}
	exit;
}

<script>
function req(prog_no, next_time){
	$.ajax({ url: '', data: { rev: prog_no}, // rev คือ parameter ที่ส่งคำขอไปยัง server
		success: rs=>{ // rs คือข้อมูลที่ server ส่งกลับมา
			switch(prog_no){ // เมื่อได้รับ result กลับมาให้ตรวจสอบ ตัวแปร prog_no เพื่อแสดงผลตรงตามตำแหน่ง
			case 1: // แสดงข้อมูลที่ตำแหน่ง ojbect ของ Datetime rev = 1
				$('object_ของ_datetime').html( rs ); break;
			case 2: // แสดงข้อมูลที่ตำแหน่ง sum total pc rev = 2
				$('object_ของ_sum_total_pc').html( rs ); break;
				/*  code php ส่วนนี้ ย้ายไปไว้ใน ที่ของมัน คือ php ส่วนของการรับ request
                    $totalpcon = 0;
                    $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily where location ='cp3' and timestamp = CURRENT_DATE group by location ;";
                    $result1 = $mysqli->query($sql1);
                    while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
                        $totalpcon = $totalpcon + $row['totalpcon'];
                    }
				*/
			case 3: // แสดงข้อมูลที่ตำแหน่ง status pc rev = 3
				$('object_ของ_status_pc').html( rs ); break;
				/*  code php ส่วนนี้ ย้ายไปไว้ใน ที่ของมัน คือ php ส่วนของการรับ request
                    $statuspc = 0;
                    $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where ip LIKE '10.183%' and statuspc = '2';";
                    $result2 = $mysqli->query($sql);
                    while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                        $statuspc = $statuspc + $row['countstatus'];
				}
				*/
			case 4: // แสดงข้อมูลที่ตำแหน่ง total pc rev = 4
				$('object_ของ_status_pc').html( rs ); break;
				/*  code php ส่วนนี้ ย้ายไปไว้ใน ที่ของมัน คือ php ส่วนของการรับ request
                    $total = 0;
                    $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
                    where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')                    group by team ;";
                    $result1 = $mysqli->query($sql1);
                    while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
                        $total = $total + $row['countpc'];
                    }
				echo $total;
				*/            
			}
			//setTimeout(()=>{ req_1,req_2,req_3(prog_no, next_time); }, next_time);
			// เมื่อทำเสร็จแล้ว ตั้งแวลาเรียกใหม่ ของแต่ละงาน ไม่ใช่เหมารวมหมด  ไวยกรณ์แบบบันทัดบน มันทำงานไม่ได้ 
			// อย่าคิดอะไรเอง อ่านบ้าง documnent มันมีรูปแบบ ในการเขียน อย่านึกว่าตัวเองเป็นอัฉจริยะ รู้ไปหมด
			setTimeout(
				()=>{
					req(prog_no,next_time); // เรียกใช้ function ตัวมันเอง (ในความเป็นจริง แค่อ้างอิงตำแหน่งเร่ิมต้น ของ function
				},
				next_time  // ด้วยระยะเวลาเก่า หรือจะเปลี่ยนแปลงเป้นอย่างอื่นก็ได้
			);
		}
	});
}
$(document).ready( ()=>{
   req(1, 1000); // ส่งคำขอ สำหรับ parameter rev = 1 สำหรับ object_datetime
   req(2, 2000); // ส่งคำขอ สำหรับ parameter rev = 2 สำหรับ object_sum_totoal_pc
   req(3, 5000); // ส่งคำขอ สำหรับ parameter rev = 3 สำหรับ object_status_pc
   req(4, 5000); // ส่งคำขอ สำหรับ parameter rev = 4 สำหรับ object_total_pc
});
</script>



ประวัติการแก้ไข
2021-02-10 05:44:52
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-10 05:43:15 By : Chaidhanan
 


 

No. 83



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 82 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-10 05:43:15
รายละเอียดของการตอบ ::
ขอบคุณครับพี่ Chaidhanan

ข้อมูลไม่แสดงครับ
1.ผมกำหนด id แล้ว <div id="object_datetime"></div>
2.code php ผมย้ายไปไว้ในส่วนของการรับ request อยู่ใน switch( $_POST['rev'] )

ภาพที่ 1
set

code testdashboardcms.php
Code (PHP)
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');

if (isset($_POST['rev']) && $_POST['rev'] == 1) { 
  set_time_limit( 1000 ); 
	/* ย้ายจาก javascript ajax function มาไว้ที่นี้  */
	switch( $_POST['rev'] ){
	case 1: // สำหรับ parameter rev = 1 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
		echo 'Dashboard : Load Time : ' . date("Y-m-d H:i:s");	
		break;

	case 2: //sum pcon
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          }
		break;

	case 3: // ----------statuspc-------->   
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where (ip LIKE '10.183%'
          or ip LIKE '10.184%') and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } 
            
		break;

	case 4: // -------count total pc ------->
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";
        
          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
        
          }
		
		break;
	}
	exit;
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
  
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
 
  <script>
function req(prog_no, next_time){
	$.ajax({ url: '', data: { rev: prog_no}, // rev คือ parameter ที่ส่งคำขอไปยัง server
		success: rs=>{ // rs คือข้อมูลที่ server ส่งกลับมา
			switch(prog_no){ // เมื่อได้รับ result กลับมาให้ตรวจสอบ ตัวแปร prog_no เพื่อแสดงผลตรงตามตำแหน่ง

			case 1: // แสดงข้อมูลที่ตำแหน่ง ojbect ของ Datetime rev = 1
				$('object_datetime').html( rs ); break;

			case 2: 
				$('object_totalpcon').html( rs ); break;
		
			case 3: 
				$('object_statuspc').html( rs ); break;
			
			case 4: 
				$('object_total').html( rs ); break;
			
			}
		
			setTimeout(
				()=>{
					req(prog_no,next_time); // เรียกใช้ function ตัวมันเอง (ในความเป็นจริง แค่อ้างอิงตำแหน่งเร่ิมต้น ของ function
				},
				next_time  // ด้วยระยะเวลาเก่า หรือจะเปลี่ยนแปลงเป้นอย่างอื่นก็ได้
			);
		}
	});
}
$(document).ready( ()=>{
   req(1, 1000); // ส่งคำขอ สำหรับ parameter rev = 1 สำหรับ object_datetime
   req(2, 2000); 
   req(3, 3000); 
   req(4, 3000); 
});
</script>

 
</head>

<body>

  <!-- start style -->
  <style>
   

    /* <<--------start card------>> */
    body {
      /* font-family: "Roboto", sans-serif;
      font-size: 15px; */
      /* color: #686c71; */
      font-weight: 400;
      background: #eff3f6;
      position: relative;
    }

    table,
    td,
    th {
      border: 0px solid green;

    }

    th {
      /* background-color: green; */
      color: green;
    }

    /* <<--------เว้นช่องระหว่าง card------>> */
    .card {
      border-radius: 2px;
      box-shadow: 0 0 0 1px #e2e5e8;
      border: none;
      margin-bottom: 30px;
      transition: all 0.5s ease-in-out;
    }

   

    /* <<--------ขนาด font h3------>> */
    .h3,
    h3 {
      font-size: 1.75rem;
    }

    /* <<--------site font h3------>> */
    h3 {
      display: block;
      /* font-size: 1.17em; */
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0px;
      margin-inline-end: 0px;
      font-weight: bold;

    }

    /* <<--------กำหนดขนาด icon------>> */
    .f-36 {
      font-size: 50px;
    }

    /* <<--------ขนาดความสูง card------>> */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin-top: 0;
      margin-bottom: .1rem;
    }

    /* <<--------จัดcard 20px hight/ 25px ขยับtext------>> */
    .card .card-block,
    .card .card-body {
      padding: 20px 25px;
    }

    /* <<--------เส้นแบ่งครึ่งแนวตั้ง footer ------>> */
    .card-social .card-active>div+div {
      border-left: 1px solid #e2e5e8;
    }


    /* <<--------start box1 cp3------>> */
    /* <<--------color text totalpc------>> */
    .text-c-green {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon------>> */
    .text-Info {
      color: #58C8AC !important;
    }


    /* <<--------start box2 tara------>> */
    /* <<--------color text totalpc------>> */
    .text-c-yellow {
      color: #19BCBF;

    }

    /* <<--------color text red footer------>> */
    .text-c-red {
      color: #FF425C;

    }

    /* <<--------กำหนดสี icon------>> */
    .text-danger {
      color: #58C8AC !important;
    }


    /* <<--------start box3 wfh------>> */
    /* <<--------color text totalpc------>> */
    .text-c-blue {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon ------>> */
    .text-primary {
      color: #58C8AC !important;
    }

    /* <<--------สีพื้นหลัง card cp3------>> */
    .bg-warning,
    .bg-warning>a {
      color: #fff !important;
      background-color: #92AAC7 !important;
    }

    /* <<--------สีพื้นหลัง card tara------>> */
    .bg-info,
    .bg-info>a {
      color: #fff !important;
      background-color: #B3DE81 !important;
    }

    /* <<--------สีพื้นหลัง card wfh------>> */
    .bg-danger,
    .bg-danger>a {
      color: #fff !important;
      background-color: #FCC875 !important;
    }
  </style>


  <nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase fixed-top">
    <a class="fas fa-desktop fa-2x" href="#"></a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link" href="index.php">Computer Management System<span class="sr-only">(current)</span></a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="dashboardcms.php">DashBoard</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="modalmasterpc.php">Master Pc</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="v_detail_pc.php">Detail Pc</a>
        </li>

        <li class="nav-item">
          <a class="nav-link" href="v_monitor_pc.php">Monitor Pc</a>
        </li>
      </ul>
    </div>
  </nav>
  <br>
  <br>

  <!-- start header -->
  <!-- <header class="masthead bg-primary"> -->
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/web analysic.png" alt="" width="72" height="72"> -->
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/logo dashboard.png"> -->
        <!-- <h2 class="display text-center text-uppercase">DashBoard Computer Management</h2> -->
        <br>
        <div id="object_datetime"></div>
        
        <hr>

        <!-----------------------------------start card cp3---------------------------------->
        <div class="row">
          <!-- sum total pc on-->
           <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where (ip LIKE '10.183%'
          or ip LIKE '10.184%') and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];

          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>                    
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <?php echo $statuspc; ?></a> </h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <class id="statuspc"></a> </h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                 
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                      
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon1 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon1 FROM monitorpc.v_check_pc_daily 
          where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon1 = $totalpcon1 + $row['totalpcon1'];
          } ?>

          <!----------statuspc-------->
          <?php
          // or ip <> left( (@target_ip:=''), length(@target_ip) - LOCATE('.', REVERSE(@target_ip)) )
          
          $statuspc1 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus1 FROM monitorpc.tbl_new_pc where ip LIKE '10.150%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {      
             $statuspc1 = $statuspc1 + $row['countstatus1'];        
          } ?>

          <!-------count total pc ------->
          <?php
          $total1 = 0;
          $sql1 = "SELECT team,count(no) as countpc1 FROM monitorpc.master_pc
                        where location ='Tara park' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total1 = $total1 + $row['countpc1'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total1; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total1"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc1; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc1"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon1; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon1"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon2 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon2 FROM monitorpc.v_check_pc_daily 
                        where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon2 = $totalpcon2 + $row['totalpcon2'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc2 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus2 FROM monitorpc.tbl_new_pc where ip LIKE '192.168%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc2 = $statuspc2 + $row['countstatus2'];
          }  ?>

          <!-------count total pc ------->
          <?php
          $total2 = 0;
          $sql1 = "SELECT team,count(no) as countpc2 FROM monitorpc.master_pc
                        where location ='wfh' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total2 = $total2 + $row['countpc2'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total2; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total2"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc2; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc2"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon2; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon2"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon  = $row6['pcon'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>
            </div>

  
      <!-- ---------------------------------------------------------------------------------------------------------------->
      <hr>
      <h5 class="text-left">PC OFF</h5>
      <br>
      <!-----------------------------------start card cp3---------------------------------->
      <div class="row">
          <!-- sum total pc off-->
           <?php
          $totalpcoff = 0;
          $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp != CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>
      
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Off</th>
                    
                  </tr>
                </thead>

                <tbody>               

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                // <<-------------sum pc off opt1 2 3 support------->>
                    $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='Tara park' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
              
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc off opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

          
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='wfh' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <h5 class="text-muted ">Total PC Off <span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>
                
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc on opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                   
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>

        <!-- <script src="js/slim.js"></script> -->
        <script src="js/popper.js"></script>
        <script src="js/bootstrap.js"></script>

</body>

</html>


ผิดตรงไหนหรือผมใส่ fucntion ไม่ถูกครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-10 15:46:26 By : chawa-2011
 


 

No. 84



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ดูตรง php case 1 มีการ echo แต่ case 2 3 4 ไม่เห็นมีการ echo แล้วจะมีข้อมูลส่งไปไหมครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-10 16:57:01 By : Chaidhanan
 


 
จาก #NO 83 บรรทัดที่ 22 เพิมเข้าไปอีก 1 ่บรรทัด
(ที่เหลือก็คงจะมองภาพออกแล้วแหล่ะ)

Code (PHP)
echo json_encode(array('d'=>1234, 'totalpcon'=>$totalpcon, 'statuspc'=>'abcd'));




Code (PHP)
<!DOCTYPE html>
<html>
<head>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>

<?php /* <-- ตัวบ่งบอกว่าเป็นภาษา PHP (<?php ?>)*/
  /*นี่คือภาษา PHP*/
   echo "My first PHP script!";
?>

<input type="text" id="txtJiMi" value="initialText" style="width: 300px;" />
<input type="button" id="btnJiMi" value="คลิ๊กโลด" />

<script> /* <-- ตัวบ่งบอกว่าเป็นภาษา JavaScript (<script> <\/script>)*/
  /*นี่คือภาษา JavaScript*/
   $("#btnJiMi").on("click", function() {
      let curDate = new Date();
      $("#txtJiMi").val(curDate);
   });
</script>

<?php /* <-- ตัวบ่งบอกว่าเป็นภาษา PHP (<?php ?>)*/
  /*นี่คือภาษา PHP*/
   echo "<br>My second PHP script!";
?>

</body>
</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 08:43:58 By : ผ่านมา
 


 
อันนี้เป็น Blazor เขียนด้วย C# จุดประสงค์ผมต้องการ ถอด BootStrap >=4 ออก
BootStrap ไม่ใช่ว่ามันไม่ดี แต่ มันดีเกินไป สำหรับผม (ผมใช้นิดเดียว)

Blazor07

Code (C#)
@layout MainLayout
@page "/admin/{name}"
@using Microsoft.AspNetCore.WebUtilities
@inject NavigationManager NavManager

<FuckerScript>
    <script>
        var stringVar1 = "Hello World";
        var intVar1 = 1;
        var dblVar1 = 99.99;
        function sayHi() {
            alert("sayHi again!!!");
        }
    </script>
</FuckerScript>

<PageContainer Title="@($"admin/{Name}")">
    <Card>
        <Alert Message="Message" Type="success" ShowIcon Banner Style="margin: -12px; margin-bottom: 48px;" /> 
        <Title Level="2" Style="text-align: center;">
            <Icon Type="smile" Theme="twotone" /> Blazor Design Pro <Icon Type="heart" Theme="twotone" TwotoneColor="#eb2f96" /> for You
        </Title>
    </Card>
    <p style="text-align: center; margin-top: 24px;">
        Want to add more pages? Please refer to @Name
        <a href="https://google.co.th" target="_blank" rel="noopener noreferrer">Google</a>                   
    </p>
</PageContainer>

@code
{
    [Parameter] public string Name { get; set; }

    protected override void OnInitialized()
    {
        var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
        if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("initialCount", out var _name))
        {
            Name = _name;
            Console.WriteLine(Name);
            //StateHasChanged();
        }
    }
}


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 09:05:27 By : ผ่านมา
 


 

No. 87



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 84 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-10 16:57:01
รายละเอียดของการตอบ ::
case 1 มีการ echo แล้ว ยัง งง ว่าทำไม่แสดงข้อมูล date เพราะ echo เป็นของ case 1 และกำหนด id ให้แล้วนะครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 09:15:16 By : chawa-2011
 


 

No. 88



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 84 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-10 16:57:01
รายละเอียดของการตอบ ::
echo แล้วนะพี่ยังไม่ได้ครับ

code testdashboardcms.php
Code (PHP)
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');

if (isset($_POST['rev']) && $_POST['rev'] == 1) { 
  set_time_limit( 1000 ); 
	/* ย้ายจาก javascript ajax function มาไว้ที่นี้  */
	switch( $_POST['rev'] ){
	case 1: // สำหรับ parameter rev = 1 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
		      echo 'Dashboard : Load Time : ' . date("Y-m-d H:i:s");	
		break;

	case 2: //sum pcon
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          }
          echo $totalpcon;
		break;

	case 3: // ----------statuspc-------->   
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where (ip LIKE '10.183%'
          or ip LIKE '10.184%') and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } 
          echo $statuspc; 
		break;

	case 4: // -------count total pc ------->
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";
        
          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
        
          }
          echo $total; 
		break;
	}
	exit;
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
  
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
 
  <script>
function req(prog_no, next_time){
	$.ajax({ url: '', data: { rev: prog_no}, // rev คือ parameter ที่ส่งคำขอไปยัง server
		success: rs=>{ // rs คือข้อมูลที่ server ส่งกลับมา
			switch(prog_no){ // เมื่อได้รับ result กลับมาให้ตรวจสอบ ตัวแปร prog_no เพื่อแสดงผลตรงตามตำแหน่ง

			case 1: // แสดงข้อมูลที่ตำแหน่ง ojbect ของ Datetime rev = 1
				$('object_datetime').html( rs ); break;

			case 2: 
				$('object_totalpcon').html( rs ); break;
		
			case 3: 
				$('object_statuspc').html( rs ); break;
			
			case 4: 
				$('object_total').html( rs ); break;
			
			}
		
			setTimeout(
				()=>{
					req(prog_no,next_time); // เรียกใช้ function ตัวมันเอง (ในความเป็นจริง แค่อ้างอิงตำแหน่งเร่ิมต้น ของ function
				},
				next_time  // ด้วยระยะเวลาเก่า หรือจะเปลี่ยนแปลงเป้นอย่างอื่นก็ได้
			);
		}
	});
}
$(document).ready( ()=>{
   req(1, 1000); // ส่งคำขอ สำหรับ parameter rev = 1 สำหรับ object_datetime
   req(2, 2000); 
   req(3, 3000); 
   req(4, 3000); 
});
</script>

 
</head>

<body>

  <!-- start style -->
  <style>
   

    /* <<--------start card------>> */
    body {
      /* font-family: "Roboto", sans-serif;
      font-size: 15px; */
      /* color: #686c71; */
      font-weight: 400;
      background: #eff3f6;
      position: relative;
    }

    table,
    td,
    th {
      border: 0px solid green;

    }

    th {
      /* background-color: green; */
      color: green;
    }

    /* <<--------เว้นช่องระหว่าง card------>> */
    .card {
      border-radius: 2px;
      box-shadow: 0 0 0 1px #e2e5e8;
      border: none;
      margin-bottom: 30px;
      transition: all 0.5s ease-in-out;
    }

   

    /* <<--------ขนาด font h3------>> */
    .h3,
    h3 {
      font-size: 1.75rem;
    }

    /* <<--------site font h3------>> */
    h3 {
      display: block;
      /* font-size: 1.17em; */
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0px;
      margin-inline-end: 0px;
      font-weight: bold;

    }

    /* <<--------กำหนดขนาด icon------>> */
    .f-36 {
      font-size: 50px;
    }

    /* <<--------ขนาดความสูง card------>> */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin-top: 0;
      margin-bottom: .1rem;
    }

    /* <<--------จัดcard 20px hight/ 25px ขยับtext------>> */
    .card .card-block,
    .card .card-body {
      padding: 20px 25px;
    }

    /* <<--------เส้นแบ่งครึ่งแนวตั้ง footer ------>> */
    .card-social .card-active>div+div {
      border-left: 1px solid #e2e5e8;
    }


    /* <<--------start box1 cp3------>> */
    /* <<--------color text totalpc------>> */
    .text-c-green {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon------>> */
    .text-Info {
      color: #58C8AC !important;
    }


    /* <<--------start box2 tara------>> */
    /* <<--------color text totalpc------>> */
    .text-c-yellow {
      color: #19BCBF;

    }

    /* <<--------color text red footer------>> */
    .text-c-red {
      color: #FF425C;

    }

    /* <<--------กำหนดสี icon------>> */
    .text-danger {
      color: #58C8AC !important;
    }


    /* <<--------start box3 wfh------>> */
    /* <<--------color text totalpc------>> */
    .text-c-blue {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon ------>> */
    .text-primary {
      color: #58C8AC !important;
    }

    /* <<--------สีพื้นหลัง card cp3------>> */
    .bg-warning,
    .bg-warning>a {
      color: #fff !important;
      background-color: #92AAC7 !important;
    }

    /* <<--------สีพื้นหลัง card tara------>> */
    .bg-info,
    .bg-info>a {
      color: #fff !important;
      background-color: #B3DE81 !important;
    }

    /* <<--------สีพื้นหลัง card wfh------>> */
    .bg-danger,
    .bg-danger>a {
      color: #fff !important;
      background-color: #FCC875 !important;
    }
  </style>


  <nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase fixed-top">
    <a class="fas fa-desktop fa-2x" href="#"></a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link" href="index.php">Computer Management System<span class="sr-only">(current)</span></a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="dashboardcms.php">DashBoard</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="modalmasterpc.php">Master Pc</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="v_detail_pc.php">Detail Pc</a>
        </li>

        <li class="nav-item">
          <a class="nav-link" href="v_monitor_pc.php">Monitor Pc</a>
        </li>
      </ul>
    </div>
  </nav>
  <br>
  <br>

  <!-- start header -->
  <!-- <header class="masthead bg-primary"> -->
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/web analysic.png" alt="" width="72" height="72"> -->
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/logo dashboard.png"> -->
        <!-- <h2 class="display text-center text-uppercase">DashBoard Computer Management</h2> -->
        <br>
        <div id="object_datetime"></div>
        
        <hr>

        <!-----------------------------------start card cp3---------------------------------->
        <div class="row">
          <!-- sum total pc on-->
           <?php
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where (ip LIKE '10.183%'
          or ip LIKE '10.184%') and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } ?>

          <!-------count total pc ------->
          <?php
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];

          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>                    
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <?php echo $statuspc; ?></a> </h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <class id="statuspc"></a> </h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                 
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                      
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon1 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon1 FROM monitorpc.v_check_pc_daily 
          where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon1 = $totalpcon1 + $row['totalpcon1'];
          } ?>

          <!----------statuspc-------->
          <?php
          // or ip <> left( (@target_ip:=''), length(@target_ip) - LOCATE('.', REVERSE(@target_ip)) )
          
          $statuspc1 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus1 FROM monitorpc.tbl_new_pc where ip LIKE '10.150%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {      
             $statuspc1 = $statuspc1 + $row['countstatus1'];        
          } ?>

          <!-------count total pc ------->
          <?php
          $total1 = 0;
          $sql1 = "SELECT team,count(no) as countpc1 FROM monitorpc.master_pc
                        where location ='Tara park' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total1 = $total1 + $row['countpc1'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total1; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total1"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc1; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc1"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon1; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon1"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon2 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon2 FROM monitorpc.v_check_pc_daily 
                        where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon2 = $totalpcon2 + $row['totalpcon2'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc2 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus2 FROM monitorpc.tbl_new_pc where ip LIKE '192.168%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc2 = $statuspc2 + $row['countstatus2'];
          }  ?>

          <!-------count total pc ------->
          <?php
          $total2 = 0;
          $sql1 = "SELECT team,count(no) as countpc2 FROM monitorpc.master_pc
                        where location ='wfh' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total2 = $total2 + $row['countpc2'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total2; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total2"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc2; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc2"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon2; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon2"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon  = $row6['pcon'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>
            </div>

  
      <!-- ---------------------------------------------------------------------------------------------------------------->
      <hr>
      <h5 class="text-left">PC OFF</h5>
      <br>
      <!-----------------------------------start card cp3---------------------------------->
      <div class="row">
          <!-- sum total pc off-->
           <?php
          $totalpcoff = 0;
          $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp != CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>
      
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Off</th>
                    
                  </tr>
                </thead>

                <tbody>               

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                // <<-------------sum pc off opt1 2 3 support------->>
                    $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='Tara park' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
              
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc off opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

          
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='wfh' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <h5 class="text-muted ">Total PC Off <span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>
                
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc on opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                   
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>

        <!-- <script src="js/slim.js"></script> -->
        <script src="js/popper.js"></script>
        <script src="js/bootstrap.js"></script>

</body>

</html>


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 09:23:57 By : chawa-2011
 


 

No. 89



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 85 เขียนโดย : ผ่านมา เมื่อวันที่ 2021-02-11 08:43:58
รายละเอียดของการตอบ ::
echo json_encode(array('d'=>1234, 'totalpcon'=>$totalpcon, 'statuspc'=>'abcd'));
ตัวนี้ มันอยู่คนละ case ทำไมต้องไปรวมใส่ไว้ใน case เดียวกันครับ

เพราะผม echo ปกติตามพี่ Chaidhanan แนะนำมาครับ เช่น echo $totalpcon; ผลก็ยังไม่แสเงเหมือนเดิมครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 09:29:28 By : chawa-2011
 


 
JSON เบื้องต้น
Code (JavaScript)
 {
 "Id" : 1,
  "firstName" : "Joe",
  "lastName" : "Biden"
 }


ภาษา JavaScript Array/Object และ List Of (T) เบื้องต้น
Code (JavaScript)
var arrJS = [];
var objJS = {};
objJS.Id = 1;
objJS.firstName = "Joe";
objJS.lastName = "Biden";
arrJS.push(objJS);

console.log(objJS.firstName);     // แสดงผล Joe
console.log(arrJS[0].firstName) ; // แสดงผล Joe

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 09:56:47 By : ผ่านมา
 


 

No. 91



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


<div class="col-6">
<!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <?php echo $statuspc; ?></a> </h6> -->
<h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <class id="statuspc"></a> </h6>
</div>


ชื่อมันไม่ใช่ เช็คให้ดีก
$('#object_statuspd').html(rs);

อ้างอิงคนละตัว แล้วมันจะตรงไหม ของผมมันแค่ตัวอย่าง เอามาใช้ก็ประยุกต์หน่อย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 10:36:32 By : Chaidhanan
 


 
ตอบความคิดเห็นที่ : 89 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-02-11 09:29:28
รายละเอียดของการตอบ ::
คุณดูตัวอย่างข้างล่างนี้ให้ดีดี ดูให้เข้าใจ แล้วคุณจะเข้าใจว่า ทำไม่ผมถึง
เปรียบเทียบ Angular ล่าสุด/ Vue ล่าสุด/React ล่าสุด ได้ด้วยตัวเอง แบบ (ลึกสุดใจ)


สรุป $.ajax(), axios, Browser, etc จะเรียกว่าอะไรก็ได้ แต่จริงฯ มันก็แค่เอาไว้
รับส่งข้อมูลระหว่าง ภาษาใดฯก็ได้ (ของคุณคือ PHP) <-- --> JavaScript มันก็เท่านั้นเอง

เพราะคุณและผมหรือใครฯ ก็ตามบนโลกใบนี้ ไม่สามารถ เขียนโปรแกรม ข้าม Block ภาษาได้

Code (PHP)
<!DOCTYPE html>
<html>
<head>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>

<?php /* <-- ตัวบ่งบอกว่าเป็นภาษา PHP (<?php ?>)*/
  /*นี่คือภาษา PHP*/
   echo "My first PHP script!";
?>

<input type="text" id="txtJiMi" value="initialText" style="width: 300px;" />
<input type="button" id="btnJiMi" value="คลิ๊กโลด" />

<script> /* <-- ตัวบ่งบอกว่าเป็นภาษา JavaScript (<script> <\/script>)*/
  /*นี่คือภาษา JavaScript*/
   $("#btnJiMi").on("click", function() {
      let curDate = new Date();
      $("#txtJiMi").val(curDate);
   });
</script>

<?php /* <-- ตัวบ่งบอกว่าเป็นภาษา PHP (<?php ?>)*/
  /*นี่คือภาษา PHP*/
   echo "<br>My second PHP script!";
?>

</body>
</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 10:59:12 By : ผ่านมา
 


 
pusher free เถอะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 11:43:56 By : guest
 


 
ตอบความคิดเห็นที่ : 93 เขียนโดย : guest เมื่อวันที่ 2021-02-11 11:43:56
รายละเอียดของการตอบ ::
คิดจะทำการใหญ่ อย่าสนใจ เรื่องเล็กฯ น้อย

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 11:49:30 By : ผ่านมา
 


 

No. 95



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 91 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-11 10:36:32
รายละเอียดของการตอบ ::
พี่ Chaidhanan ครับ
ผมแก้ไข
1.กำหนดชื่อ id ตรงกับชื่อ object แล้วครับ ข้อมูลยังไม่แสดงข้อมูลครับ แต่มีการโหลดเข้ามาครับ การแสดงผลเพี้ยนครับ
ภาพที่ 1
p

code
Code (PHP)
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');

if (isset($_POST['rev']) && $_POST['rev'] == 1) { 
  set_time_limit( 1000 ); 
	/* ย้ายจาก javascript ajax function มาไว้ที่นี้  */
	switch( $_POST['rev'] ){
	case 1: // สำหรับ parameter rev = 1 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
		      echo 'Dashboard : Load Time : ' . date("Y-m-d H:i:s");	
		break;

	case 2: //sum pcon
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          }
          echo $totalpcon;
		break;

	case 3: // ----------statuspc-------->   
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where (ip LIKE '10.183%'
          or ip LIKE '10.184%') and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } 
          echo $statuspc; 
		break;

	case 4: // -------count total pc ------->
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";
        
          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
        
          }
          echo $total; 
		break;
	}
	exit;
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
  
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
 
  <script>
function req(prog_no, next_time){
	$.ajax({ url: '', data: { rev: prog_no}, // rev คือ parameter ที่ส่งคำขอไปยัง server
		success: rs=>{ // rs คือข้อมูลที่ server ส่งกลับมา
			switch(prog_no){ // เมื่อได้รับ result กลับมาให้ตรวจสอบ ตัวแปร prog_no เพื่อแสดงผลตรงตามตำแหน่ง

			case 1: // แสดงข้อมูลที่ตำแหน่ง ojbect ของ Datetime rev = 1
				$('#datetime').html( rs ); break;

			case 2: 
				$('#totalpcon').html( rs ); break;
		
			case 3: 
				$('#statuspc').html( rs ); break;
			
			case 4: 
				$('#total').html( rs ); break;
			
			}
		
			setTimeout(
				()=>{
					req(prog_no,next_time); // เรียกใช้ function ตัวมันเอง (ในความเป็นจริง แค่อ้างอิงตำแหน่งเร่ิมต้น ของ function
				},
				next_time  // ด้วยระยะเวลาเก่า หรือจะเปลี่ยนแปลงเป้นอย่างอื่นก็ได้
			);
		}
	});
}
$(document).ready( ()=>{
   req(1, 1000); // ส่งคำขอ สำหรับ parameter rev = 1 สำหรับ object_datetime
   req(2, 2000); 
   req(3, 2000); 
   req(4, 2000); 
});
</script>

 
</head>

<body>

  <!-- start style -->
  <style>
   

    /* <<--------start card------>> */
    body {
      /* font-family: "Roboto", sans-serif;
      font-size: 15px; */
      /* color: #686c71; */
      font-weight: 400;
      background: #eff3f6;
      position: relative;
    }

    table,
    td,
    th {
      border: 0px solid green;

    }

    th {
      /* background-color: green; */
      color: green;
    }

    /* <<--------เว้นช่องระหว่าง card------>> */
    .card {
      border-radius: 2px;
      box-shadow: 0 0 0 1px #e2e5e8;
      border: none;
      margin-bottom: 30px;
      transition: all 0.5s ease-in-out;
    }

   

    /* <<--------ขนาด font h3------>> */
    .h3,
    h3 {
      font-size: 1.75rem;
    }

    /* <<--------site font h3------>> */
    h3 {
      display: block;
      /* font-size: 1.17em; */
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0px;
      margin-inline-end: 0px;
      font-weight: bold;

    }

    /* <<--------กำหนดขนาด icon------>> */
    .f-36 {
      font-size: 50px;
    }

    /* <<--------ขนาดความสูง card------>> */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin-top: 0;
      margin-bottom: .1rem;
    }

    /* <<--------จัดcard 20px hight/ 25px ขยับtext------>> */
    .card .card-block,
    .card .card-body {
      padding: 20px 25px;
    }

    /* <<--------เส้นแบ่งครึ่งแนวตั้ง footer ------>> */
    .card-social .card-active>div+div {
      border-left: 1px solid #e2e5e8;
    }


    /* <<--------start box1 cp3------>> */
    /* <<--------color text totalpc------>> */
    .text-c-green {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon------>> */
    .text-Info {
      color: #58C8AC !important;
    }


    /* <<--------start box2 tara------>> */
    /* <<--------color text totalpc------>> */
    .text-c-yellow {
      color: #19BCBF;

    }

    /* <<--------color text red footer------>> */
    .text-c-red {
      color: #FF425C;

    }

    /* <<--------กำหนดสี icon------>> */
    .text-danger {
      color: #58C8AC !important;
    }


    /* <<--------start box3 wfh------>> */
    /* <<--------color text totalpc------>> */
    .text-c-blue {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon ------>> */
    .text-primary {
      color: #58C8AC !important;
    }

    /* <<--------สีพื้นหลัง card cp3------>> */
    .bg-warning,
    .bg-warning>a {
      color: #fff !important;
      background-color: #92AAC7 !important;
    }

    /* <<--------สีพื้นหลัง card tara------>> */
    .bg-info,
    .bg-info>a {
      color: #fff !important;
      background-color: #B3DE81 !important;
    }

    /* <<--------สีพื้นหลัง card wfh------>> */
    .bg-danger,
    .bg-danger>a {
      color: #fff !important;
      background-color: #FCC875 !important;
    }
  </style>


  <nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase fixed-top">
    <a class="fas fa-desktop fa-2x" href="#"></a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link" href="index.php">Computer Management System<span class="sr-only">(current)</span></a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="dashboardcms.php">DashBoard</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="modalmasterpc.php">Master Pc</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="v_detail_pc.php">Detail Pc</a>
        </li>

        <li class="nav-item">
          <a class="nav-link" href="v_monitor_pc.php">Monitor Pc</a>
        </li>
      </ul>
    </div>
  </nav>
  <br>
  <br>

  <!-- start header -->
  <!-- <header class="masthead bg-primary"> -->
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/web analysic.png" alt="" width="72" height="72"> -->
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/logo dashboard.png"> -->
        <!-- <h2 class="display text-center text-uppercase">DashBoard Computer Management</h2> -->
        <br>
        <div id="datetime"></div>
        
        <hr>

        <!-----------------------------------start card cp3---------------------------------->
        <div class="row">
          <!-- sum total pc on-->
           <?php
          // $totalpcon = 0;
          // $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          // where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          // $result1 = $mysqli->query($sql1);
          // while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
          //   $totalpcon = $totalpcon + $row['totalpcon'];
          // } ?>

          <!----------statuspc-------->
          <?php
          // $statuspc = 0;
          // $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where (ip LIKE '10.183%'
          // or ip LIKE '10.184%') and statuspc = '2';";
          // $result2 = $mysqli->query($sql);
          // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
          //   $statuspc = $statuspc + $row['countstatus'];
          // } ?>

          <!-------count total pc ------->
          <?php
          // $total = 0;
          // $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          // where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          // group by team ;";

          // $result1 = $mysqli->query($sql1);
          // while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
          //   $total = $total + $row['countpc'];

          // } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>                    
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <?php echo $statuspc; ?></a> </h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <class id="statuspc"></a> </h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                 
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                      
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon1 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon1 FROM monitorpc.v_check_pc_daily 
          where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon1 = $totalpcon1 + $row['totalpcon1'];
          } ?>

          <!----------statuspc-------->
          <?php
          // or ip <> left( (@target_ip:=''), length(@target_ip) - LOCATE('.', REVERSE(@target_ip)) )
          
          $statuspc1 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus1 FROM monitorpc.tbl_new_pc where ip LIKE '10.150%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {      
             $statuspc1 = $statuspc1 + $row['countstatus1'];        
          } ?>

          <!-------count total pc ------->
          <?php
          $total1 = 0;
          $sql1 = "SELECT team,count(no) as countpc1 FROM monitorpc.master_pc
                        where location ='Tara park' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total1 = $total1 + $row['countpc1'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total1; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total1"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc1; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc1"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon1; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon1"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon2 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon2 FROM monitorpc.v_check_pc_daily 
                        where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon2 = $totalpcon2 + $row['totalpcon2'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc2 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus2 FROM monitorpc.tbl_new_pc where ip LIKE '192.168%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc2 = $statuspc2 + $row['countstatus2'];
          }  ?>

          <!-------count total pc ------->
          <?php
          $total2 = 0;
          $sql1 = "SELECT team,count(no) as countpc2 FROM monitorpc.master_pc
                        where location ='wfh' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total2 = $total2 + $row['countpc2'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total2; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total2"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc2; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc2"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon2; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon2"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon  = $row6['pcon'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>
            </div>

  
      <!-- ---------------------------------------------------------------------------------------------------------------->
      <hr>
      <h5 class="text-left">PC OFF</h5>
      <br>
      <!-----------------------------------start card cp3---------------------------------->
      <div class="row">
          <!-- sum total pc off-->
           <?php
          $totalpcoff = 0;
          $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp != CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>
      
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Off</th>
                    
                  </tr>
                </thead>

                <tbody>               

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                // <<-------------sum pc off opt1 2 3 support------->>
                    $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='Tara park' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
              
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc off opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

          
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='wfh' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <h5 class="text-muted ">Total PC Off <span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>
                
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc on opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                   
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>

        <!-- <script src="js/slim.js"></script> -->
        <script src="js/popper.js"></script>
        <script src="js/bootstrap.js"></script>

</body>

</html>


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 12:18:24 By : chawa-2011
 


 
@TOR ไปทำความเข้าใจมาใหม่
เอ็งเข้าใจ ผิดหมดเลย สมองมีเยอะ เสียดาย สมอง

Code (PHP)
  <!-- start style -->
  <style>
   

    /* <<--------start card------>> */
    body {
      /* font-family: "Roboto", sans-serif;
      font-size: 15px; */
      /* color: #686c71; */
      font-weight: 400;
      background: #eff3f6;
      position: relative;
    }

    table,
    td,
    th {
      border: 0px solid green;

    }

    th {
      /* background-color: green; */
      color: green;
    }

    /* <<--------เว้นช่องระหว่าง card------>> */
    .card {
      border-radius: 2px;
      box-shadow: 0 0 0 1px #e2e5e8;
      border: none;
      margin-bottom: 30px;
      transition: all 0.5s ease-in-out;
    }

   

    /* <<--------ขนาด font h3------>> */
    .h3,
    h3 {
      font-size: 1.75rem;
    }

    /* <<--------site font h3------>> */
    h3 {
      display: block;
      /* font-size: 1.17em; */
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0px;
      margin-inline-end: 0px;
      font-weight: bold;

    }

    /* <<--------กำหนดขนาด icon------>> */
    .f-36 {
      font-size: 50px;
    }

    /* <<--------ขนาดความสูง card------>> */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin-top: 0;
      margin-bottom: .1rem;
    }

    /* <<--------จัดcard 20px hight/ 25px ขยับtext------>> */
    .card .card-block,
    .card .card-body {
      padding: 20px 25px;
    }

    /* <<--------เส้นแบ่งครึ่งแนวตั้ง footer ------>> */
    .card-social .card-active>div+div {
      border-left: 1px solid #e2e5e8;
    }


    /* <<--------start box1 cp3------>> */
    /* <<--------color text totalpc------>> */
    .text-c-green {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon------>> */
    .text-Info {
      color: #58C8AC !important;
    }


    /* <<--------start box2 tara------>> */
    /* <<--------color text totalpc------>> */
    .text-c-yellow {
      color: #19BCBF;

    }

    /* <<--------color text red footer------>> */
    .text-c-red {
      color: #FF425C;

    }

    /* <<--------กำหนดสี icon------>> */
    .text-danger {
      color: #58C8AC !important;
    }


    /* <<--------start box3 wfh------>> */
    /* <<--------color text totalpc------>> */
    .text-c-blue {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon ------>> */
    .text-primary {
      color: #58C8AC !important;
    }

    /* <<--------สีพื้นหลัง card cp3------>> */
    .bg-warning,
    .bg-warning>a {
      color: #fff !important;
      background-color: #92AAC7 !important;
    }

    /* <<--------สีพื้นหลัง card tara------>> */
    .bg-info,
    .bg-info>a {
      color: #fff !important;
      background-color: #B3DE81 !important;
    }

    /* <<--------สีพื้นหลัง card wfh------>> */
    .bg-danger,
    .bg-danger>a {
      color: #fff !important;
      background-color: #FCC875 !important;
    }
  </style>


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 14:29:49 By : ผ่านมา
 


 

No. 97



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


<a target="_blank" href="pcnew.php"> <class id="statuspc"></a>

อันหยังวะ 55555

แก้เป็น
<a target="_blank" href="pcnew.php" id="statuspc"></a>

ปล. น่าจะเริ่ม getting start ใหม่เลยก็ดีนะ

html คืออะไร มีรูปแบบวิธีการเขียนยังไง
javascript คืออะไร มีรูปแบบวิธีการเขียนยังไง
php คืออะไร มีรูปแบบวิธีการเขียนยังไง


ประวัติการแก้ไข
2021-02-11 14:49:39
2021-02-11 14:50:45
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 14:47:47 By : Chaidhanan
 


 

No. 98



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 97 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-11 14:47:47
รายละเอียดของการตอบ ::
ขอบคุณครับ พี่ Chaidhanan

แก้แล้วครับ
Code
1.<h5 class="text-muted ">Total PC <span class="text-c-green mb-0 " id="total"></span></h5>
2.<h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php" id="statuspc"></a> </h6>
3.<h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 " id="totalpcon"></h6>

หน้าเว็บมีการโหลด แต่ไม่แสดงอะไรเลยครับ

code
Code (PHP)
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');

if (isset($_POST['rev']) && $_POST['rev'] == 1) { 
  set_time_limit( 1000 ); 
	/* ย้ายจาก javascript ajax function มาไว้ที่นี้  */
	switch( $_POST['rev'] ){
	case 1: // สำหรับ parameter rev = 1 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
		      echo 'Dashboard : Load Time : ' . date("Y-m-d H:i:s");	
		break;

	case 2: //sum pcon
          $totalpcon = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon = $totalpcon + $row['totalpcon'];
          }
          echo $totalpcon;
		break;

	case 3: // ----------statuspc-------->   
          $statuspc = 0;
          $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where (ip LIKE '10.183%'
          or ip LIKE '10.184%') and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc = $statuspc + $row['countstatus'];
          } 
          echo $statuspc; 
		break;

	case 4: // -------count total pc ------->
          $total = 0;
          $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          group by team ;";
        
          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total = $total + $row['countpc'];
        
          }
          echo $total; 
		break;
	}
	exit;
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
  
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
 
  <script>
function req(prog_no, next_time){
	$.ajax({ url: '', data: { rev: prog_no}, // rev คือ parameter ที่ส่งคำขอไปยัง server
		success: rs=>{ // rs คือข้อมูลที่ server ส่งกลับมา
			switch(prog_no){ // เมื่อได้รับ result กลับมาให้ตรวจสอบ ตัวแปร prog_no เพื่อแสดงผลตรงตามตำแหน่ง

			case 1: // แสดงข้อมูลที่ตำแหน่ง ojbect ของ Datetime rev = 1
				$('#datetime').html( rs ); break;

			case 2: 
				$('#totalpcon').html( rs ); break;
		
			case 3: 
				$('#statuspc').html( rs ); break;
			
			case 4: 
				$('#total').html( rs ); break;
			
			}
		
			setTimeout(
				()=>{
					req(prog_no,next_time); // เรียกใช้ function ตัวมันเอง (ในความเป็นจริง แค่อ้างอิงตำแหน่งเร่ิมต้น ของ function
				},
				next_time  // ด้วยระยะเวลาเก่า หรือจะเปลี่ยนแปลงเป้นอย่างอื่นก็ได้
			);
		}
	});
}
$(document).ready( ()=>{
   req(1, 1000); // ส่งคำขอ สำหรับ parameter rev = 1 สำหรับ object_datetime
   req(2, 2000); 
   req(3, 2000); 
   req(4, 2000); 
});
</script>

 
</head>

<body>

  <!-- start style -->
  <style>
   

    /* <<--------start card------>> */
    body {
      /* font-family: "Roboto", sans-serif;
      font-size: 15px; */
      /* color: #686c71; */
      font-weight: 400;
      background: #eff3f6;
      position: relative;
    }

    table,
    td,
    th {
      border: 0px solid green;

    }

    th {
      /* background-color: green; */
      color: green;
    }

    /* <<--------เว้นช่องระหว่าง card------>> */
    .card {
      border-radius: 2px;
      box-shadow: 0 0 0 1px #e2e5e8;
      border: none;
      margin-bottom: 30px;
      transition: all 0.5s ease-in-out;
    }

   

    /* <<--------ขนาด font h3------>> */
    .h3,
    h3 {
      font-size: 1.75rem;
    }

    /* <<--------site font h3------>> */
    h3 {
      display: block;
      /* font-size: 1.17em; */
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0px;
      margin-inline-end: 0px;
      font-weight: bold;

    }

    /* <<--------กำหนดขนาด icon------>> */
    .f-36 {
      font-size: 50px;
    }

    /* <<--------ขนาดความสูง card------>> */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin-top: 0;
      margin-bottom: .1rem;
    }

    /* <<--------จัดcard 20px hight/ 25px ขยับtext------>> */
    .card .card-block,
    .card .card-body {
      padding: 20px 25px;
    }

    /* <<--------เส้นแบ่งครึ่งแนวตั้ง footer ------>> */
    .card-social .card-active>div+div {
      border-left: 1px solid #e2e5e8;
    }


    /* <<--------start box1 cp3------>> */
    /* <<--------color text totalpc------>> */
    .text-c-green {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon------>> */
    .text-Info {
      color: #58C8AC !important;
    }


    /* <<--------start box2 tara------>> */
    /* <<--------color text totalpc------>> */
    .text-c-yellow {
      color: #19BCBF;

    }

    /* <<--------color text red footer------>> */
    .text-c-red {
      color: #FF425C;

    }

    /* <<--------กำหนดสี icon------>> */
    .text-danger {
      color: #58C8AC !important;
    }


    /* <<--------start box3 wfh------>> */
    /* <<--------color text totalpc------>> */
    .text-c-blue {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon ------>> */
    .text-primary {
      color: #58C8AC !important;
    }

    /* <<--------สีพื้นหลัง card cp3------>> */
    .bg-warning,
    .bg-warning>a {
      color: #fff !important;
      background-color: #92AAC7 !important;
    }

    /* <<--------สีพื้นหลัง card tara------>> */
    .bg-info,
    .bg-info>a {
      color: #fff !important;
      background-color: #B3DE81 !important;
    }

    /* <<--------สีพื้นหลัง card wfh------>> */
    .bg-danger,
    .bg-danger>a {
      color: #fff !important;
      background-color: #FCC875 !important;
    }
  </style>


  <nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase fixed-top">
    <a class="fas fa-desktop fa-2x" href="#"></a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link" href="index.php">Computer Management System<span class="sr-only">(current)</span></a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="dashboardcms.php">DashBoard</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="modalmasterpc.php">Master Pc</a>
        </li>

        <li class="nav-item ">
          <a class="nav-link" href="v_detail_pc.php">Detail Pc</a>
        </li>

        <li class="nav-item">
          <a class="nav-link" href="v_monitor_pc.php">Monitor Pc</a>
        </li>
      </ul>
    </div>
  </nav>
  <br>
  <br>

  <!-- start header -->
  <!-- <header class="masthead bg-primary"> -->
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/web analysic.png" alt="" width="72" height="72"> -->
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/logo dashboard.png"> -->
        <!-- <h2 class="display text-center text-uppercase">DashBoard Computer Management</h2> -->
        <br>
        <div id="datetime"></div>
        
        <hr>

        <!-----------------------------------start card cp3---------------------------------->
        <div class="row">
          <!-- sum total pc on-->
           <?php
          // $totalpcon = 0;
          // $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          // where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          // $result1 = $mysqli->query($sql1);
          // while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
          //   $totalpcon = $totalpcon + $row['totalpcon'];
          // } ?>

          <!----------statuspc-------->
          <?php
          // $statuspc = 0;
          // $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where (ip LIKE '10.183%'
          // or ip LIKE '10.184%') and statuspc = '2';";
          // $result2 = $mysqli->query($sql);
          // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
          //   $statuspc = $statuspc + $row['countstatus'];
          // } ?>

          <!-------count total pc ------->
          <?php
          // $total = 0;
          // $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          // where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          // group by team ;";

          // $result1 = $mysqli->query($sql1);
          // while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
          //   $total = $total + $row['countpc'];

          // } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>                    
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 " id="total"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php"> <?php echo $statuspc; ?></a> </h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "><a target="_blank" href="pcnew.php" id="statuspc"></a> </h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 " id="totalpcon"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                 
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                      
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon1 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon1 FROM monitorpc.v_check_pc_daily 
          where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon1 = $totalpcon1 + $row['totalpcon1'];
          } ?>

          <!----------statuspc-------->
          <?php
          // or ip <> left( (@target_ip:=''), length(@target_ip) - LOCATE('.', REVERSE(@target_ip)) )
          
          $statuspc1 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus1 FROM monitorpc.tbl_new_pc where ip LIKE '10.150%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {      
             $statuspc1 = $statuspc1 + $row['countstatus1'];        
          } ?>

          <!-------count total pc ------->
          <?php
          $total1 = 0;
          $sql1 = "SELECT team,count(no) as countpc1 FROM monitorpc.master_pc
                        where location ='Tara park' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total1 = $total1 + $row['countpc1'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total1; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total1"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc1; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc1"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon1; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon1"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon2 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon2 FROM monitorpc.v_check_pc_daily 
                        where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon2 = $totalpcon2 + $row['totalpcon2'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc2 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus2 FROM monitorpc.tbl_new_pc where ip LIKE '192.168%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc2 = $statuspc2 + $row['countstatus2'];
          }  ?>

          <!-------count total pc ------->
          <?php
          $total2 = 0;
          $sql1 = "SELECT team,count(no) as countpc2 FROM monitorpc.master_pc
                        where location ='wfh' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total2 = $total2 + $row['countpc2'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total2; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total2"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc2; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc2"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon2; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon2"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon  = $row6['pcon'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>
            </div>

  
      <!-- ---------------------------------------------------------------------------------------------------------------->
      <hr>
      <h5 class="text-left">PC OFF</h5>
      <br>
      <!-----------------------------------start card cp3---------------------------------->
      <div class="row">
          <!-- sum total pc off-->
           <?php
          $totalpcoff = 0;
          $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp != CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>
      
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Off</th>
                    
                  </tr>
                </thead>

                <tbody>               

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                // <<-------------sum pc off opt1 2 3 support------->>
                    $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='Tara park' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
              
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc off opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

          
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='wfh' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <h5 class="text-muted ">Total PC Off <span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>
                
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc on opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                   
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>

        <!-- <script src="js/slim.js"></script> -->
        <script src="js/popper.js"></script>
        <script src="js/bootstrap.js"></script>

</body>

</html>




แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-11 18:12:27 By : chawa-2011
 


 

No. 99



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


ข้างบน #30 บอกเรื่องการจัดสัดส่วน อะไรอยู่ตรงไหน ก็ดูเหมือนไม่ได้อ่านเลยสักนิดเดียว
ยังดันทุรังเอา stylesheet ยัดมันลงไปใน body อยู่นั่น....

อยากจะแนะนำให้แยกไฟล์ไปเลยนะ css, js ไปส่วนนึงเลย อะไรงี้ให้โค้ดมันดูง่ายสบายตา แต่เห็นอ่านภาษาไทยก็ยังอ่านไม่รู้เรื่องหรือไม่อ่านก็ไม่รู้ เลยท้อใจที่จะบอกซะแล้ว
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-12 00:59:26 By : mr.v
 


 

No. 100



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


tag เปิดแล้วก็ต้องปิด มันมีความสำคัญ ถ้าไม่ปิด ขอบเขตมันกว้าง ข้อความบางอย่างก็อาจจะหายไปได้

<span>xxxxx</span> แบบ hard code กำหนดข้อความเลย
หรือ
<span /> แบบรอ runtime ใส่ข้อมูลที่หลัง
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-12 06:52:16 By : Chaidhanan
 


 

No. 101



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


สถานี สาเกตนคร

Quote:
Details Can’t Go Before the Big Picture.



Code (PHP)
<!-- Header: timezone วางส่วนนี้ -->
<body>  
  <nav><!-- Menu --></nav><br><br>
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/web analysic.png" alt="" width="72" height="72"> -->
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/logo dashboard.png"> -->
        <!-- <h2 class="display text-center text-uppercase">DashBoard Computer Management</h2> -->
        <br>
		
		<?php if (isset($_POST['rev']) && $_POST['rev'] == 1) { set_time_limit( 180 ); ?>
		<!-- *** Start Realtime : บรรทัดหลังจากนี้จะแสดงข้อมูลแบบอัปเดตตามเวลาที่ตั้งใน setTimeout() *** -->
        <div><?php echo 'Dashboard : Load Time : ' . date("Y-m-d H:i:s"); ?></div>
        
        <hr>

        <!----------------------------------- PC ON ---------------------------------->
        <div class="row">
		  <!-- ส่วนนี้สามารถทำเป็น dynamic template -->
		  <div class="col-md-12 col-xl-4"><!-- Card cp3 --></div>
		  <div class="col-md-12 col-xl-4"><!-- Card tara --></div>
		  <div class="col-md-12 col-xl-4"><!-- Card wfh --></div>
		</div> <!-- End PC ON -->
		
		<hr>
		
		<!----------------------------------- PC OFF ---------------------------------->
        <h5 class="text-left">PC OFF</h5>
        <br>
		<div class="row">
		  <!-- ส่วนนี้สามารถทำเป็น dynamic template -->
		  <div class="col-md-12 col-xl-4"><!-- Card cp3 --></div>
		  <div class="col-md-12 col-xl-4"><!-- Card tara --></div>
		  <div class="col-md-12 col-xl-4"><!-- Card wfh --></div>
		</div> <!-- End PC OFF -->
		<?php } ?> <!-- *** End Realtime *** -->
	  </div> <!-- col-lg-12 -->
	</div> <!-- row -->
  </div> <!-- container -->
  
  <script>
  $(function() {  // ready
    function realTime() {  // recursive function
      var t = setTimeout(function(){
	  	$.ajax({     
          method: "POST",   
          data: { rev: 1 }     
        });
		realTime()  // Recursively Call
	  }, 1000);   // 1 sec realtime
    }
  });
  </script>
</body>
<!-- Footer -->



ประวัติการแก้ไข
2021-02-12 13:49:05
2021-02-12 14:02:51
2021-02-12 14:08:36
2021-02-12 14:09:13
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-12 13:42:19 By : lakornworld
 


 
@Tor ก่อนอื่น Copy Source Code ด้านล่างนี้ไปลองรันและทำความเข้าใจดู (ต่อยอดมาจากคุณ Chinahan)
สร้างไฟล์ HTML ขึ้นมา ตั้งชื่อว่าอะไรก็ได้ เช่น ABC.html
แล้วใช้ Browser ตัวไหนก็ได้เปิดไฟล์นี้ขึ้นมา (แนะนำให้ใช้ Microsoft Edge)

ถ่างตาดู และทำความเข้าใจกับมัน อย่าคิดแต่ว่าเข้าใจ

Code (PHP)
<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
          integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
          crossorigin="anonymous">

    <title>Hello, world!</title>
</head>
<body>

    <h1 id="totalPC1">Hello, world! 2122242362482510</h1>
    <h1 id="totalPC2">Hello, world! 2122242362482510</h1>

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.5.1.min.js"
            integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
            crossorigin="anonymous"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
            integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
            crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
            integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
            crossorigin="anonymous"></script>

    <script>
        $(function () {
            function req(prog_no, next_time) {
                setTimeout(function () {
                    $.ajax({
                        url: 'Fucker.Error', // ตั้งใจให้เกิด Eeror ตอนใช้จริงก็เปลี่ยนด้วยล่ะ
                        data: { rev: 1 },
                        //dataType: "dorSon",
                        success: function (response) { // 1x
                            // ต่อให้ Error มันก็ยังวิ่งไปที่ 2x และทำงานต่อไปเรื่อยฯ
                            console.log(response.TotalPC2);
                            //switch (prog_no) {
                            //    case 1:
                            //        $("#totalPC1").html('น้องเมียอวบไหม?: ' + new Date());
                            //        break;
                            //    case 2:
                            //        $("#totalPC2").html('น้องเมียขาขาวไหม?: ' + new Date());
                            //}
                        }
                    }).always(function () {  // 2x
                        // ไม่หวั่นแม้วันมามาก มันทำงานสม่ำเสมอ
                        switch (prog_no) {
                            case 1:
                                $("#totalPC1").html('น้องเมียอวบไหม?: ' + new Date());
                                break;
                            case 2:
                                $("#totalPC2").html('น้องเมียขาขาวไหม?: ' + new Date());
                        }

                        req(prog_no, next_time);
                    });
                }, next_time);
            };

            req(1, 1000); // มันคล้ายฯ Batch Job นั่นแหละว่ามั้ย
            req(2, 3000); // มันคล้ายฯ Batch Job นั่นแหละว่ามั้ย
        });
    </script>
</body>
</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-13 08:20:33 By : ผ่านมา
 


 

No. 103



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 99 เขียนโดย : mr.v เมื่อวันที่ 2021-02-12 00:59:26
รายละเอียดของการตอบ ::
ขอบคุณครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-14 00:21:54 By : chawa-2011
 


 

No. 104



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 100 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-12 06:52:16
รายละเอียดของการตอบ ::
ขอบคุณครับ เดี๋ยวผมจะลองเปิด-ปิด tag ดูครับเผื่อข้อมูลจะมาครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-14 00:23:49 By : chawa-2011
 


 

No. 105



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 101 เขียนโดย : lakornworld เมื่อวันที่ 2021-02-12 13:42:19
รายละเอียดของการตอบ ::
ขอบคุณครับ เรื่องสับสนไปเรื่อยๆครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-14 00:25:35 By : chawa-2011
 


 

No. 106



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 102 เขียนโดย : ผ่านมา เมื่อวันที่ 2021-02-13 08:20:33
รายละเอียดของการตอบ ::
ขอบคุณครับ ลองทำล่ะ
ผลลัพธ์
น้องเมียอวบไหม?: Sun Feb 14 2021 00:36:12 GMT+0700 (เวลาอินโดจีน)
น้องเมียขาขาวไหม?: Sun Feb 14 2021 00:36:10 GMT+0700 (เวลาอินโดจีน)

จาก code พี่ Chinahan แนะนำให้ ย้ายจาก javascript ajax function ไว้ใน php แล้วนี่


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-14 00:32:19 By : chawa-2011
 


 

No. 108



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 106 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-02-14 00:32:19
รายละเอียดของการตอบ ::
อ่านคอมเมนท์ สีเขียว ที่เขาเขียน และ วิเคราะห์ code


ต้องเพิ่มเติม ส่วนที่ เป็นเออเร่อร์ เอาเองด้วย ซึงไม่ยากถ้าเข้าใจ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-14 03:24:13 By : Chaidhanan
 


 
ดูเหมือนไม่มีอะไร แต่ก็ดีใจที่ถอด Bootstrap ออกได้โดยสมบูรณ์
สำหรับคนอื่นฯ อาจจะมองว่ามันง่ายในความง่ายฯ เอง
แต่สำหรับเรา มันยากถึงยากมาก เลยเชียวแหล่ะ

DoHe
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-14 03:37:25 By : ผ่านมา
 


 

No. 110



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ตัวอย่าง algorithm พอสังเขป
ปล. มันย่อยได้ อีกหลายไฟล์ วิเคราะห์เอาหน่อย ไม่จำเป็นต้องเป็น ไฟล์เดียวรวมมันหมดทุกอย่าง
แต่ละไฟล์ก็หมายถีง หลายหน้า ซึ่ง parser สามารถเปิดได้ทั้งหมด ง่ายต่อการแก้ไข ไม่ต้องเลือน หรือต้องใช้ tool อื่นๆ
Main.php
Code (PHP)
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');
$rev = isset($_POST['rev']) ? intval($_POST['rev']) : 0;
if( $rev>0 ){ 
	set_time_limit( 1000 ); 
	/* ย้ายจาก javascript ajax function มาไว้ที่นี้  */
	switch( $rev ){
	case 1: // สำหรับ parameter rev = 1 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
		echo 'Dashboard : Load Time : ' . date("Y-m-d H:i:s"); 
		exit; // ถ้าแน่ใจว่า ไม่ทำอะไรต่อ ใช้ exit จบการทำงาน php เลยก็ได้ ดีกว่า ใช้ break ออกการทำงานที่ละลำดับ;
	case 2: //sum pcon		
		/*
		$sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
			where location ='cp3' and timestamp = CURRENT_DATE group by location ;";
			***** ปรับการคิวรี่ ทำซะที่ database server เลย ความต้องการ ไม่ได้แยก group แล้วจะไป group by ทำไม
			*/
		$sql = "select sum(total) as ttl from monitorpc.V_check_pc_daily 
where location ='cp3' and `timestamp` = CURRENT_DATE";
		// ศึกษาการใช้ quote ต่างๆ ว่ามันใช้ยังไง ลดภาระ การทำงาน ของ interpreter ลง ไม่ต้อง ตรวจเช็คค่ามากมาย
		$rs = $mysqli->query($sql) or die( $mysqli->error.'<br>'.$sql);
		echo $rs->fetch_object()->ttl; exit;
		// ตัดโค๊ดที่ไม่จำเป็นออก ลดภาระหน่วยความจำ และระยะเวลาการคำนวณ ลง เมื่อแน่ใจว่าโค๊ด ไม่มี error
		break;

	case 3: // ----------statuspc-------->   
		$sql = "SELECT count(ip) as ttc FROM monitorpc.tbl_new_pc 
where left(ip,1,6) in ('10.183', '10.184') and statuspc = 2";
		$rs = $mysqli->query($sql) or die( $mysqli->error.'<br>'.$sql);
		echo $rs->fetch_object()->ttc; exit;
	case 4: // -------count total pc ------->
		$sql = "SELECT count(no) as ttp FROM monitorpc.master_pc
where location = 'cp3' and `type` in ('PC Gosoft','Notebook Gosoft', 'All in one')";        
		$result1 = $mysqli->query($sql1);
		echo $rs->fetch_object()->ttp; exit;
	}
	exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DashBoard</title>
<link rel="stylesheet" href="bootstrap/bootstrap.css">  
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<link rel="stylesheet" href="start.css">  <!-- style sheet จับยัดลงไปในไฟล์ -->
<script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.js"></script>
<script>
function req(prog_no, next_time){
	$.ajax({ url: '', data: { rev: prog_no}, // rev คือ parameter ที่ส่งคำขอไปยัง server
		success: rs=>{ // rs คือข้อมูลที่ server ส่งกลับมา
			switch(prog_no){ // เมื่อได้รับ result กลับมาให้ตรวจสอบ ตัวแปร prog_no เพื่อแสดงผลตรงตามตำแหน่ง
			case 1: // แสดงข้อมูลที่ตำแหน่ง ojbect ของ Datetime rev = 1
				$('#datetime').html( rs ); break;
			case 2: $('#totalpcon').html( rs ); break;		
			case 3: $('#statuspc').html( rs ); break;			
			case 4: $('#total').html( rs ); break;			
			}		
			setTimeout(
				()=>{
					req(prog_no,next_time); // เรียกใช้ function ตัวมันเอง (ในความเป็นจริง แค่อ้างอิงตำแหน่งเร่ิมต้น ของ function
				},
				next_time  // ด้วยระยะเวลาเก่า หรือจะเปลี่ยนแปลงเป้นอย่างอื่นก็ได้
			);
		}
	});
}
$(document).ready( ()=>{
   req(1, 1000); // ส่งคำขอ สำหรับ parameter rev = 1 สำหรับ object_datetime
   req(2, 2000); 
   req(3, 2000); 
   req(4, 2000); 
});
</script>
</head>
<body>
	<!-- start style ย้าย ไปไว้ใน ไฟล์  start.css เรียกใช้จากส่วน head -->
	<nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase fixed-top">
		<a class="fas fa-desktop fa-2x" href="#"></a>
		<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
			<span class="navbar-toggler-icon"></span>
		</button>
		<div class="collapse navbar-collapse" id="navbarSupportedContent">
			<ul class="navbar-nav mr-auto">
				<li class="nav-item active">
					<a class="nav-link" href="index.php">Computer Management System
						<span class="sr-only">(current)</span></a>
					</li>
				<li class="nav-item "><a class="nav-link" href="dashboardcms.php">DashBoard</a></li>
				<li class="nav-item "><a class="nav-link" href="modalmasterpc.php">Master Pc</a></li>
				<li class="nav-item "><a class="nav-link" href="v_detail_pc.php">Detail Pc</a></li>
				<li class="nav-item"><a class="nav-link" href="v_monitor_pc.php">Monitor Pc</a></li>
			</ul>
		</div>
	</nav>
	<br>
	<br>
	<!-- start header -->
	<!-- <header class="masthead bg-primary"> -->
	<div class="container">
		<div class="row ">
			<div class="col-lg-12">
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/web analysic.png" alt="" width="72" height="72"> -->
        <!-- <br><img class="d-block mx-auto mb-4" src="bg/logo dashboard.png"> -->
        <!-- <h2 class="display text-center text-uppercase">DashBoard Computer Management</h2> -->
				<br>
				<div id="datetime"></div>        
				<hr>
				<!-----------------------------------start card cp3---------------------------------->
				<div class="row">
				<!-- sum total pc on-->
					<div class="col-md-12 col-xl-4">
						<div class="card card-social">
							<div class="card-block border-bottom">
								<div class="row align-items-center justify-content-center">
									<div class="col-auto"><i class="fas fa-desktop text-Info f-36"></i></div>
									<div class="col text-right">
										<h3>Location CP3</h3>
										<h5 class="text-muted ">
											Total PC <span class="text-c-green mb-0" id="total"></span></h5>
									</div>
								</div>
							</div>
							<div class="card-block">
								<div class="row align-items-center justify-content-center card-active">
									<div class="col-6">
										<h6 class="text-center m-b-10">
											<span class="text-muted m-r-5">Total PC New:</span>
											<span class="text-c-red mb-0 ">
												<a target="_blank" href="pcnew.php" id="statuspc"></a>
											</span>
										</h6>
									</div>
									<div class="col-6">
										<h6 class="text-center  m-b-10">
											<span class="text-muted m-r-5">Total PC ON:</span>
											<span class="text-c-red mb-0 " id="totalpcon"></span>
										</h6>
									</div>
								</div>
							</div>
							<?php include 'show_table_1.php'; ?>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>


show_table_1.php
Code (PHP)
<?php
$sql = "SELECT m.team ,
sum(m.type='pc gosoft') pc_gosoft,
sum(m.type='pc cpall') pc_cpall,
sum(m.type='all in one') all_in_one,
sum(m.type='notebook gosoft') notebook,
(SELECT sum(d.total) FROM monitorpc.v_check_pc_daily d
where d.location = m.location and d.timestamp = CURRENT_DATE and d.team = m.team) as pcon 
FROM monitorpc.master_pc m 
where location ='cp3' group by team ;";
$tb1 = $mysqli->query($sql);
?>
<table class="table  table-bordered text-center" style="font-size:8pt;">
<thead>
	<tr>
	<th>Team</th><th>PC Gosoft</th><th>PC CPAll</th><th>AIO</th><th>NB Gosoft</th><th>PC ON</th>
	</tr>
</thead>
<tbody>
<?php
	while ($row = $tb1->fetch_object()) {?>
	<tr>
		<td><?= $ro->pc_gosoft ?></td>
		<td><?= $ro->pc_cpall ?></td>
		<td><?= $ro->all_in_one ?></td>
		<td><?= $ro->notebook ?></td>
		<td><?= $ro->pcon ?></td>
		<td><span class="text-c-red mb-0 "><?php echo $ro->pcon ?></td>
		</tr>
<?php } ?>
</tbody>
</table>
<?php }


start.css
Code (PHP)
    /* <<--------start card------>> */
    body {
      /* font-family: "Roboto", sans-serif;
      font-size: 15px; */
      /* color: #686c71; */
      font-weight: 400;
      background: #eff3f6;
      position: relative;
    }

    table,
    td,
    th {
      border: 0px solid green;

    }

    th {
      /* background-color: green; */
      color: green;
    }

    /* <<--------เว้นช่องระหว่าง card------>> */
    .card {
      border-radius: 2px;
      box-shadow: 0 0 0 1px #e2e5e8;
      border: none;
      margin-bottom: 30px;
      transition: all 0.5s ease-in-out;
    }

   

    /* <<--------ขนาด font h3------>> */
    .h3,
    h3 {
      font-size: 1.75rem;
    }

    /* <<--------site font h3------>> */
    h3 {
      display: block;
      /* font-size: 1.17em; */
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0px;
      margin-inline-end: 0px;
      font-weight: bold;

    }

    /* <<--------กำหนดขนาด icon------>> */
    .f-36 {
      font-size: 50px;
    }

    /* <<--------ขนาดความสูง card------>> */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin-top: 0;
      margin-bottom: .1rem;
    }

    /* <<--------จัดcard 20px hight/ 25px ขยับtext------>> */
    .card .card-block,
    .card .card-body {
      padding: 20px 25px;
    }

    /* <<--------เส้นแบ่งครึ่งแนวตั้ง footer ------>> */
    .card-social .card-active>div+div {
      border-left: 1px solid #e2e5e8;
    }


    /* <<--------start box1 cp3------>> */
    /* <<--------color text totalpc------>> */
    .text-c-green {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon------>> */
    .text-Info {
      color: #58C8AC !important;
    }


    /* <<--------start box2 tara------>> */
    /* <<--------color text totalpc------>> */
    .text-c-yellow {
      color: #19BCBF;

    }

    /* <<--------color text red footer------>> */
    .text-c-red {
      color: #FF425C;

    }

    /* <<--------กำหนดสี icon------>> */
    .text-danger {
      color: #58C8AC !important;
    }


    /* <<--------start box3 wfh------>> */
    /* <<--------color text totalpc------>> */
    .text-c-blue {
      color: #19BCBF;
    }

    /* <<--------กำหนดสี icon ------>> */
    .text-primary {
      color: #58C8AC !important;
    }

    /* <<--------สีพื้นหลัง card cp3------>> */
    .bg-warning,
    .bg-warning>a {
      color: #fff !important;
      background-color: #92AAC7 !important;
    }

    /* <<--------สีพื้นหลัง card tara------>> */
    .bg-info,
    .bg-info>a {
      color: #fff !important;
      background-color: #B3DE81 !important;
    }

    /* <<--------สีพื้นหลัง card wfh------>> */
    .bg-danger,
    .bg-danger>a {
      color: #fff !important;
      background-color: #FCC875 !important;
    }




ประวัติการแก้ไข
2021-02-14 05:01:46
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-14 04:55:48 By : Chaidhanan
 


 

No. 111



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ที่มันทำงานแค่ date เพราะ condition สีแดง เฉพาะ 1
if (isset($_POST['rev']) && $_POST['rev'] == 1) {
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-14 05:04:28 By : Chaidhanan
 


 

No. 112



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 110 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-14 04:55:48
รายละเอียดของการตอบ ::
ขอบคุณครับ

แต่ผมลองศึกษาและทำตามคำแนะนำแล้ว ยังไม่ได้เลยครับ
ผลลัพธ์
1.ยังเกิดอาการเดิมครับ
2. show_table_1.php เรียกมาแล้ว error มันเกี่ยวข้องกันยังไงหรอครับ และถ้าไม่เรียกใช้ได้ไหมครับ ผมสับสนไปหมดแล้ว หรือเรียกใช้แล้วให้ป็นอีก template หนึ่ง
3.เรื่อง ajax realtime พี่ๆทุกคนเข้าใจดี แต่สำหรับผมอาจยาก ยากมาก
4.ผมควรเปลี่ยนไปใช้ auto refresh ดีหรือไม่ครับ
5. ผมอยากให้ date ทำงานได้ก่อน เพราะถ้า date ไม่ทำงานผมไปต่อไม่ได้เลย ถ้าเอาแค่ date ตอนนี้ date ยังไม่แสดง

table

เพิ่มเติม error แบบนี้ไฟล์ jqury ผมไม่ถูกเปล่า code เก่า setInterval
่jq




ประวัติการแก้ไข
2021-02-15 11:52:25
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-15 11:37:53 By : chawa-2011
 


 

No. 113



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 112 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-02-15 11:37:53
รายละเอียดของการตอบ ::
อ่าว...เห็นคำขอบคุณ นึกว่าสำเร็จไปแล้ว

ตอนแรกยังไม่ต้องเล่นกับ response ลองวาง card และรายละเอียดตามโครงที่ผมทำ/ถอดจากโค้ดพันบรรทัดไว้ให้ใน สถานีร้อยเอ็ด (สาเกตนคร)
เพื่อดูการทำงานของมันก่อน...ถ้าจะให้เห็นภาพคือ echo date หรือข้อมูลง่ายๆ จะเห็นภาพชัดเจนขึ้น


ส่วนที่ว่าสับสน ก็ถามตามสิ่งที่ไม่เข้าใจโดยตรง โพสต์บอกไปเลยครับ เช่น
"ใน javascript ตัวนำเนินการเคยเห็นแต่ >= , <= แล้ว => มันคืออะไร" เป็นต้น
แต่ถ้าไม่เห็นถามคนตอบก็จะมโนเองว่า จขกท.เข้าใจแล้ว

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-15 11:52:51 By : lakornworld
 


 
@Chaidhanan

Limitless มันสุดยอดจริงฯ (ทำไมพึ่งมาบอก[ว่ะ])

ขอบคุณมากฯฯฯ เลยครับผม
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-15 12:39:14 By : ผ่านมา
 


 
อันนี้ให้ท่าน @Chaidhanan แทนคำขอบคุณครับผม

Code (C#)
@page "/DoHeFromJS"
<FuckerScript>
   <script>
      var jsAss = {};
      jsAss.เพราะขน = function () {
          const number = prompt("Enter your number");
          DotNet.invokeMethodAsync("sayHiJSInterop", "หอยงาม", parseInt(number), true)
              .then(result => {
                  let el = document.getElementById("string-result");
                  el.innerHTML = result;
              });
      }
   </script>
</FuckerScript>
<div class="row">
    <div class="col-md-4">
        <h4>Calling C# static method from JavaScript WITHOUT RESTful API </h4>
    </div>
    <div class="col-md-2">
        <button type="button" class="btn btn-success" onclick="jsAss.เพราะขน()">
            Calculate
        </button>
    </div>
    <div class="col-md-6">
        <span id="string-result" class="form-text" style="font-size:128px"></span>
    </div>
</div>

@code {
   [JSInvokable("หอยงาม")] // ชื่อต้องไม่ซ้ำกันนะในแต่ละ AssemblyNameXXX.MyFunction
    public static string CalculateSquareRoot(int number, bool justResult)
    {
        var result = Math.Sqrt(number);
        return !justResult ? $"The square root of {number} is {result}" : result.ToString();
    }
}

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-15 12:44:01 By : ผ่านมา
 


 

No. 116



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 113 เขียนโดย : lakornworld เมื่อวันที่ 2021-02-15 11:52:51
รายละเอียดของการตอบ ::
ขอบคุณของผม หมายถึงว่า ขอบคุณที่พี่ๆบอก และแนะนำมา แต่เอาไปทำแล้วยังไม่สำเร็จนะครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-15 12:49:01 By : chawa-2011
 


 

No. 117



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ผมจัด code ใหม่ เอา card cp3 ครับ
ผลลัพธ์ ดูจาก console มีการโหลดข้อมูล แบบ loop ทั้งหน้า และข้อมูล realtime ไม่แสดงครับ

code testdashboardcms.php
Code (PHP)
<?php
require_once('connection.php');
date_default_timezone_set('Asia/Bangkok');

$rev = isset($_POST['rev']) ? intval($_POST['rev']) : 0; 
if( $rev>0 ){ 
	set_time_limit( 1000 ); 
  
  $totalpcon = 0;
	$sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily where location ='cp3' and timestamp = CURRENT_DATE group by location ;";
	$result1 = $mysqli->query($sql1);
	while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
		$totalpcon = $totalpcon + $row['totalpcon'];
	}

  // --------statuspc--------
	$statuspc = 0;
	$sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where ip LIKE '10.183%' or ip LIKE '10.184%' and statuspc = '2';";
	$result2 = $mysqli->query($sql);
	while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
		$statuspc = $statuspc + $row['countstatus'];
  }

  // -------count total pc ------->
  $total = 0;
  $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
  where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
  group by team ;";

  $result1 = $mysqli->query($sql1);
  while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
    $total = $total + $row['countpc'];
  }  
	/* ย้ายจาก javascript ajax function มาไว้ที่นี้  */
	switch( $rev ){
    case 1: echo 'Dashboard : Load Time : ' . date("Y-m-d H:i:s"); exit; // สำหรับ parameter rev = 1 จะส่งอะไรไปให้ client เขียนโค๊ด ส่งไปตรงนี้
    case 2: echo $totalpcon ; exit;
    case 3: echo $statuspc; exit;
    case 4: echo $total; exit;
       
	}
	exit;
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>DashBoard</title>

  <link rel="stylesheet" href="bootstrap/bootstrap.css">
  <link rel="stylesheet" type="text/css" href="stylesheet/styles.css">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

  <script language="javascript" src="jquery/jquery-3.5.1.min.js"></script>
  <script src="js/popper.js"></script>
  <script src="js/bootstrap.js"></script>

  <script>
function req(prog_no, next_time){
	$.ajax({ url: '', data: { rev: prog_no}, // rev คือ parameter ที่ส่งคำขอไปยัง server
		success: rs=>{ // rs คือข้อมูลที่ server ส่งกลับมา
			switch(prog_no){ // เมื่อได้รับ result กลับมาให้ตรวจสอบ ตัวแปร prog_no เพื่อแสดงผลตรงตามตำแหน่ง

			case 1: $('#datetime').html( rs ); break; // แสดงข้อมูลที่ตำแหน่ง ojbect ของ Datetime rev = 1
			case 2: $('#totalpcon').html( rs ); break;
			case 3: $('#statuspc').html( rs ); break;
			case 4: $('#total').html( rs ); break;	
			}		
			setTimeout(
				()=>{
					req(prog_no,next_time); // เรียกใช้ function ตัวมันเอง (ในความเป็นจริง แค่อ้างอิงตำแหน่งเร่ิมต้น ของ function
				},
				next_time  // ด้วยระยะเวลาเก่า หรือจะเปลี่ยนแปลงเป้นอย่างอื่นก็ได้
			);
		}
	});
}
$(document).ready( ()=>{
   req(1, 1000); // ส่งคำขอ สำหรับ parameter rev = 1 สำหรับ object_datetime
   req(2, 2000); 
   req(3, 2000); 
   req(4, 2000); 
});
</script>
 
</head>

<body>

  <nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase fixed-top">
    <a class="fas fa-desktop fa-2x" href="#"></a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link" href="index.php">Computer Management System
            <span class="sr-only">(current)</span></a>
        </li>
        <li class="nav-item "><a class="nav-link" href="dashboardcms.php">DashBoard</a></li>
        <li class="nav-item "><a class="nav-link" href="modalmasterpc.php">Master Pc</a></li>
        <li class="nav-item "><a class="nav-link" href="v_detail_pc.php">Detail Pc</a></li>
        <li class="nav-item"><a class="nav-link" href="v_monitor_pc.php">Monitor Pc</a></li>
      </ul>
    </div>
  </nav>
  <br>
  <br>

  <!-- start header -->
  <!-- <header class="masthead bg-primary"> -->
  <div class="container">
    <div class="row ">
      <div class="col-lg-12">
        <br>
        <div id="datetime"></div>
        
        <hr>

        <!-----------------------------------start card cp3---------------------------------->
        <div class="row">
          <!-- sum total pc on-->
           <?php
          // $totalpcon = 0;
          // $sql1 = "SELECT location,sum(total) as totalpcon FROM monitorpc.v_check_pc_daily 
          // where location ='cp3' and timestamp = CURRENT_DATE group by location ;";

          // $result1 = $mysqli->query($sql1);
          // while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
          //   $totalpcon = $totalpcon + $row['totalpcon'];
          // } ?>

          <!----------statuspc-------->
          <?php
          // $statuspc = 0;
          // $sql = "SELECT ip, statuspc, count(ip) as countstatus FROM monitorpc.tbl_new_pc where (ip LIKE '10.183%'
          // or ip LIKE '10.184%') and statuspc = '2';";
          // $result2 = $mysqli->query($sql);
          // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
          //   $statuspc = $statuspc + $row['countstatus'];
          // } ?>

          <!-------count total pc ------->
          <?php
          // $total = 0;
          // $sql1 = "SELECT team,count(no) as countpc FROM monitorpc.master_pc
          // where location ='cp3' and (type = 'PC Gosoft' or type = 'Notebook Gosoft' or type = 'All in one')
          // group by team ;";

          // $result1 = $mysqli->query($sql1);
          // while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
          //   $total = $total + $row['countpc'];

          // } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>                    
                    <h5 class="text-muted ">Total PC 
                      <span class="text-c-green mb-0 " id="total"></span>
                    </h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <h6 class="text-center m-b-10">
                      <span class="text-muted m-r-5">Total PC New:</span>
                      <span class="text-c-red mb-0 " target="_blank" href="pcnew.php" id="statuspc"></span>
                  </h6>
                  </div>
                  <div class="col-6">
                    <h6 class="text-center  m-b-10">
                      <span class="text-muted m-r-5">Total PC ON:</span>
                      <span class="text-c-red mb-0 " id="totalpcon"></span>
                    </h6>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                 
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='cp3' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='cp3'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp = CURRENT_DATE and team = '$team'";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                      
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon1 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon1 FROM monitorpc.v_check_pc_daily 
          where location ='Tara park' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon1 = $totalpcon1 + $row['totalpcon1'];
          } ?>

          <!----------statuspc-------->
          <?php
          // or ip <> left( (@target_ip:=''), length(@target_ip) - LOCATE('.', REVERSE(@target_ip)) )
          
          $statuspc1 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus1 FROM monitorpc.tbl_new_pc where ip LIKE '10.150%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {      
             $statuspc1 = $statuspc1 + $row['countstatus1'];        
          } ?>

          <!-------count total pc ------->
          <?php
          $total1 = 0;
          $sql1 = "SELECT team,count(no) as countpc1 FROM monitorpc.master_pc
                        where location ='Tara park' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total1 = $total1 + $row['countpc1'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total1; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total1"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc1; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc1"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon1; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon1"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='Tara park' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='Tara park'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon = $row6['pcon'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc on-->
          <?php
          $totalpcon2 = 0;
          $sql1 = "SELECT location,sum(total) as totalpcon2 FROM monitorpc.v_check_pc_daily 
                        where location ='wfh' and timestamp = CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcon2 = $totalpcon2 + $row['totalpcon2'];
          } ?>

          <!----------statuspc-------->
          <?php
          $statuspc2 = 0;
          $sql = "SELECT statuspc, count(ip) as countstatus2 FROM monitorpc.tbl_new_pc where ip LIKE '192.168%'
          and statuspc = '2';";
          $result2 = $mysqli->query($sql);
          while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
            $statuspc2 = $statuspc2 + $row['countstatus2'];
          }  ?>

          <!-------count total pc ------->
          <?php
          $total2 = 0;
          $sql1 = "SELECT team,count(no) as countpc2 FROM monitorpc.master_pc
                        where location ='wfh' group by team ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $total2 = $total2 + $row['countpc2'];
          } ?>
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <!-- <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "> <?php echo $total2; ?></span></h5> -->
                    <h5 class="text-muted ">Total PC <span class="text-c-green mb-0 "><class id="total2"></span></h5>
                  </div>
                </div>
              </div>
              <div class="card-block">
                <div class="row align-items-center justify-content-center card-active">
                  <div class="col-6">
                    <!-- <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <?php echo $statuspc2; ?></h6> -->
                    <h6 class="text-center m-b-10"><span class="text-muted m-r-5">Total PC New:</span><span class="text-c-red mb-0 "> <class id="statuspc2"></h6>
                  </div>
                  <div class="col-6">
                    <!-- <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <?php echo  $totalpcon2; ?></h6> -->
                    <h6 class="text-center  m-b-10"><span class="text-muted m-r-5">Total PC ON:</span><span class="text-c-red mb-0 "> <class id="totalpcon2"></h6>
                  </div>
                </div>
              </div>
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Gosoft</th>
                    <th>PC CPAll</th>
                    <th>AIO</th>
                    <th>NB Gosoft</th>
                    <th>PC ON</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  // <<-------------sum pc on opt1 2 3 support------->>
                  // $sql = "SELECT team,sum(total) as total1 FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  //   and timestamp = CURRENT_DATE group by team;";

                  // $result2 = $mysqli->query($sql);
                  // while ($row = $result2->fetch_array(MYSQLI_ASSOC)) {
                  //   $_arrname[$row['team']] = $row['total1'];
                  // }

                  ?>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                    // count opt pc gosoft
                    $num2 = 0;
                    $sql2 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc gosoft' and team = '$team' ;";
                    $result2 = $mysqli->query($sql2);
                    while ($row2 = $result2->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row2['countpc'];
                      $num2 += 1;
                    }
                    // count opt pc cpall
                    $num3 = 0;
                    $sql3 = "SELECT  team as countpc FROM monitorpc.master_pc where location ='wfh' 
                    and type = 'pc cpall' and team = '$team' ;";
                    $result3 = $mysqli->query($sql3);
                    while ($row3 = $result3->fetch_array(MYSQLI_ASSOC)) {
                      // $countpc = $row3['countpc'];
                      $num3 += 1;
                    }

                    // all in one
                    $num4 = 0;
                    $sql4 = "SELECT team as countpcaio FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'all in one' and team = '$team' ;";
                    $result4 = $mysqli->query($sql4);
                    while ($row4 = $result4->fetch_array(MYSQLI_ASSOC)) {
                      //  $countpcaio = $row4['countpcaio'];
                      $num4 += 1;
                    }

                    // notebook gosoft
                    $num5 = 0;
                    $sql5 = "SELECT team as countnb FROM monitorpc.master_pc where location ='wfh'  
                     and type = 'notebook gosoft' and team = '$team' ;";
                    $result5 = $mysqli->query($sql5);
                    while ($row5 = $result5->fetch_array(MYSQLI_ASSOC)) {
                      //  $countnb = $row5['countnb'];
                      $num5 += 1;
                    }

                    // <<-------------sum pc on opt1 2 3 support------->>
                    $sql6 = "SELECT team,sum(total) as pcon FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                    and timestamp = CURRENT_DATE and team = '$team';";

                    $result6 = $mysqli->query($sql6);
                    while ($row6 = $result6->fetch_array(MYSQLI_ASSOC)) {
                      $pcon  = $row6['pcon'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><?= $num2 ?></td>
                      <td><?= $num3 ?></td>
                      <td><?= $num4 ?></td>
                      <td><?= $num5 ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcon ?></td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>
            </div>

  
      <!-- ---------------------------------------------------------------------------------------------------------------->
      <hr>
      <h5 class="text-left">PC OFF</h5>
      <br>
      <!-----------------------------------start card cp3---------------------------------->
      <div class="row">
          <!-- sum total pc off-->
           <?php
          $totalpcoff = 0;
          $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
          where location ='cp3' and timestamp != CURRENT_DATE group by location ;";

          $result1 = $mysqli->query($sql1);
          while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>
      
          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location CP3</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                    <th>Team</th>
                    <th>PC Off</th>
                    
                  </tr>
                </thead>

                <tbody>               

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='cp3' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                // <<-------------sum pc off opt1 2 3 support------->>
                    $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'cp3' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     
                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card tara---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='Tara park' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location Tara</h3>
                    <h5 class="text-muted ">Total PC Off<span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
              
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>

                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='Tara park' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc off opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'Tara park' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }

          
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                     

                    </tr>
                  <?php } ?>
                </tbody>

              </table>

            </div>
          </div>



          <!-----------------------------------start card wfh---------------------------------->
          <!-- sum total pc off-->
          <?php
           $totalpcoff = 0;
           $sql1 = "SELECT location,sum(total) as totalpcoff FROM monitorpc.v_check_pc_daily 
           where location ='wfh' and timestamp != CURRENT_DATE group by location ;";
 
           $result1 = $mysqli->query($sql1);
           while ($row = $result1->fetch_array(MYSQLI_ASSOC)) {
             $totalpcoff = $totalpcoff + $row['totalpcoff'];
          } ?>

          <div class="col-md-12 col-xl-4">
            <div class="card card-social ">
              <div class="card-block border-bottom">
                <div class="row align-items-center justify-content-center">
                  <div class="col-auto">
                    <i class="fas fa-desktop text-Info f-36"></i>
                  </div>
                  <div class="col text-right">
                    <h3>Location WFH</h3>
                    <h5 class="text-muted ">Total PC Off <span class="text-c-red mb-0 "> <?php echo  $totalpcoff; ?></span></h5>
                  </div>
                </div>
              </div>
             
              <table class="table  table-bordered text-center" style="font-size:8pt;">
                <thead>
                  <tr>
                  <th>Team</th>
                  <th>PC Off</th>
                  </tr>
                </thead>

                <tbody>
                
                  <!-- <<-------------total count opt1 2 3 support------->
                  <?php
                  $sql = "SELECT team FROM monitorpc.master_pc where location ='wfh' group by team ;";
                  $result = $mysqli->query($sql);
                  while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                    $team = $row['team'];

                  // <<-------------sum pc on opt1 2 3 support------->>
                  $sql7 = "SELECT team,sum(total) as pcoff FROM monitorpc.v_check_pc_daily where location = 'wfh' 
                  and timestamp != CURRENT_DATE and team = '$team';";

                    $result7 = $mysqli->query($sql7);
                    while ($row7 = $result7->fetch_array(MYSQLI_ASSOC)) {
                      $pcoff = $row7['pcoff'];
                    }
                  ?>
                    <tr>
                      <td><?= $team ?></td>
                      <td><span class="text-c-red mb-0 "><?php echo $pcoff ?></td>
                   
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
            </div>

       

</body>

</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-15 13:10:42 By : chawa-2011
 


 

No. 118



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 113 เขียนโดย : lakornworld เมื่อวันที่ 2021-02-15 11:52:51
รายละเอียดของการตอบ ::
ความคิดนี้ดีมาเลยครับ จขกท ทำดูนะครับ จะได้รู้ว่า มันทำงานยังไง ตัดสิ่งที่ไม่ใช้ออกไปก่อน เอาแค่ การทำงาน realtime ก่อน


ไฟล์ใหญ่ไปก็งง

ตอบความคิดเห็นที่ : 110 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-14 04:55:48
รายละเอียดของการตอบ ::
เสร็จแล้ว ก็มาอ่านวิเคราะห์ code การคิวรี่ที่ความเห็นนี้ ผมย่อ คำสั่งคิวรี่ ที่ต้องใช้เวลานาน ให้แล้ว
เขียนการคิวรี่ หลายครั้งเกิน มันสามารถเขียน รวมกันได้

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-15 15:49:02 By : Chaidhanan
 


 

No. 119



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 118 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-15 15:49:02
รายละเอียดของการตอบ ::
code คิวรี่ที่ตัดให้สั้นลง ผมเข้าใจนะ เพื่อลดการทำงาน

ส่วนที่ต้องเรียกอีกไฟล์มาใช้งานนี้ครับ ผมไม่เข้าใจ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-16 13:57:05 By : chawa-2011
 


 

No. 120



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 119 เขียนโดย : chawa-2011 เมื่อวันที่ 2021-02-16 13:57:05
รายละเอียดของการตอบ ::
ไฟล์ใหญ่ แยกเป็นไฟล์ ย่อยๆ แยกส่วนการทำงาน


เชื่อมต่อ ไฟล์ ด้วยคำสั่ง include ไม่ใช่การเรียกใช้ไฟล์อื่น

แค่เป็นการต่อไฟล์ เข้าด้วยกัน

a.php
Code (PHP)
<div>
<?php include 'b.php'; ?>
</div>


b.php
Code (PHP)
<span >Test</span>


เมื่อเรียกไฟล์ a.php จะเท่ากับ
Code (PHP)
<div>
<span >Test</span>
</div>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-16 18:03:57 By : Chaidhanan
 


 

No. 121



โพสกระทู้ ( 245 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 120 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-16 18:03:57
รายละเอียดของการตอบ ::
เชื่อมต่อ ไฟล์ ด้วยคำสั่ง include ไม่ใช่การเรียกใช้ไฟล์อื่น

ผมพอมองภาพออกครับ
ส่วนนี้ เวลา include มาแล้วครับ ถ้าถูกก็แสดงข้อมูล และต่อมา ไฟล์ include จะเชื่อม realtime ได้อย่างไร ที่ถาม เพราะว่า มันแยกส่วนการทำงาน include เข้ามา

สำหรับที่ผมคิดนะ คือ เอาข้อมูลที่ include เข้ามาไปเชื่อม realtime โดยที่ไม่ต้องไปยุ่งกับหน้าที่เรา include เข้ามา น่าจะถูกหรือไม่ ผมทำดูครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-17 15:22:23 By : chawin1
 


 

No. 122



โพสกระทู้ ( 4,720 )
บทความ ( 8 )



สถานะออฟไลน์


แยกออกเป็นส่วนๆแล้ว include ให้มันอ่านง่าย
อย่างเช่น
<!DOCTYPE... ไปจนถึง <body> ถ้าหลายๆไฟล์มันใช้เหมือนๆกัน ก็แยกไปเลยก็ได้ เป็น common/pageHTMLHead.php
แล้วส่วน </body>ไปจนถึงปิด </html> ก็แยกไป เช่น common/pageHTMLFoot.php
แบบนี้เป็นต้น แล้วเราก็จะได้โค้ดสั้นลงในหน้านั้นคือใช้แค่ include 'common/pageHTMLHead.php'; ในส่วนหัว และ include 'common/pageHTMLFoot.php'; ในส่วนท้ายด้านล่าง.


ส่วนอื่นๆก็ยังแยกได้อีก เช่น page header ที่มันมีพวก logo, navbar อะไรพวกนี้ ถ้าหลายๆหน้ามันเหมือนกัน ก็แยกไปเลยแล้วใช้ include ร่วมกัน มันก็สั้นลงไปอีกในหน้าหลัก
พยายามแยกที่มันซ้ำๆเหมือนๆกันออกไปก่อนแล้วใช้ include เพื่อให้มันอ่านง่ายกว่านี้ ไม่ใช่ยาวเป็นพรวนโดยไม่จำเป็น


แล้วส่วนของ ajax นี่ผมก็ยังไม่ได้ดูเพราะโค้ดยาวจัด
ผมคิดเอาจากที่ยังไม่ได้ดูทั้งหมด ว่าการส่งค่า ajax จากทางฝั่ง server ก็น่าจะแยกไปอีกไฟล์หนึ่ง มันจะได้เฉพาะเจาะจงลงไป ทำหน้าที่ของมันโดยเฉพาะ แล้วก็จะอ่านง่ายขึ้น
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-17 16:16:00 By : mr.v
 


 

No. 123



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


เฉลย เลยแล้วกัน จขกท. ไม่เล่นด้วย
No. 101 จะไม่ทำงานเพราะ ตามคำใบ้ใน No. 113



อันนี้คือของจริง คัดลอกวางในไฟล์เปล่า


Code (PHP)
<?php
date_default_timezone_set('Asia/Bangkok');

if (isset($_POST['rev']) && $_POST['rev'] == 1) {
	echo '<span style="color:green;">' . date("Y-m-d H:i:s") . ' second row</span><br>';
	exit;
}
?>


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>

<?php
echo date("Y-m-d H:i:s") . ' first row<br>';
?>

<div id="rt"></div>

<?php
echo date("Y-m-d H:i:s") . ' last row<br>';
print_r($_POST);
?>

<script>

$(function() {
  function realTime() {
    setTimeout(function(){
 	  $.ajax({ 		
          method: "POST",   
          data: { rev: 1 }     
        }).done(function( data ) {
          $("#rt").html(data);
        });
	  realTime();
    }, 1000);
  }
  realTime();
});


</script>
</body>
</html>



จะได้ สีเขียว realtime อยู่ที่เดียว
ผล


ถ้าตอบคำถามได้ว่า ...
"ทำอย่างไรให้มีการ realtime ทั้งหมดทุกบรรทัด"

ก็จะแก้ปัญหาของ จขกท. ได้
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-17 18:27:35 By : lakornworld
 


 
เอาใส่เรียบร้อยแล้ว Limitless ตามที่ท่าน Chainahan แนะนำ เราได้ข้อสรุปว่า
ไม่ทิ้งของเดิม BootStrap 4 และเฉพาะกรอบสีแดงใช้ของใหม่ FuckStrap 0.1


เราใช้เวลาเดือนกว่าฯ ศึกษาเทคโนโลยีใหม่ฯ ทุกฯตัว เลยน่ะ ไล่ตั้งแต่
React Native
Flutter Native
Vue 3 lastest
Angular lastest
และอื่นฯอีก หมดโลกเลยมั้ง


ในที่สุดก็ได้ข้อสรุปที่ลงตัว ลดการเขียน Source code ลงไปได้มากโข (เราคิดว่าเกิน 70% เลยนะ)

เราเป็น SA/Programmer ในคนคนเดียวกัน
เราไม่ได้ดีแต่พูด

sumary_choice
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-18 08:11:09 By : ผ่านมา
 


 

No. 125



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 124 เขียนโดย : ผ่านมา เมื่อวันที่ 2021-02-18 08:11:09
รายละเอียดของการตอบ ::
900฿ ถือว่าโอเคเลย แถม compat IE 10 ด้วย ...ยังไงลองเทสใน brave ให้ดูหน่อยครับ
แต่ถ้าไม่ใช้ IE 10 มีของดีราคาประหยัด (300฿) ออกใหม่สดๆ ก็น่าสน

Quote:
ไม้ก๊อก Cork




IE11 ผ่านฉลุย...
รันบน Kestrel (จริงป่ะ)

Z-hoax


ประวัติการแก้ไข
2021-02-18 10:13:27
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-18 10:09:40 By : lakornworld
 


 
ระดับนี้แล้ว ละเอียดรอบคอบ ทดสอบหลายร้อยรอบ
แต่ไม่ว่าจะใช้อะไรก็ไม่ส่งผลกับ FuckStrap 0.1 ได้หรอก
เหตุผล CSS มันขึ้นด้วย ไม่มีทางซ้ำได้เลย
(ทำเป็น Isolation CSS)

Code (PHP)
FuckStrap_wrapper
FuckStrap_header
FuckStrap_sidebar_l
FuckStrap_sidebar_r
FuckStrap_content
FuckStrap_footer


fuckerStrap_2
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-18 10:40:37 By : ผ่านมา
 


 
@lakornworld

เป้าหมายของผมไม่ใช่เวป ไม่ใช่แค่มือถือ หรือการเขียนโปรแกรมอะไรเลย
ผมคิดว่า โปรแกรม ใครฯก็เขียนได้ ไม่เก่งวันนี้ วันข้างหน้าเดี๋ยวมันก็เก่งขึ้นเองแหละ

แต่ผมจะไปวัดและไปสู้ ในสนาม ใครออกแบบระบบ และรู้จริง มากกว่ากัน ต่างหาก
(น้อยมากนะในเมืองไทยนี้)


ปล. ผมมองไกลมาก ไกลโขเลยเชียวแหละ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-18 10:57:36 By : ผ่านมา
 


 

No. 128



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 123 เขียนโดย : lakornworld เมื่อวันที่ 2021-02-17 18:27:35
รายละเอียดของการตอบ ::
จขกท. พยายามทำความเข้าใจกระบวนการทำงานของมัน...ไม่เข้าใจส่วนไหนให้ถาม

Realtime AJAX based on No.123




ตอบความคิดเห็นที่ : 127 เขียนโดย : ผ่านมา เมื่อวันที่ 2021-02-18 10:57:36
รายละเอียดของการตอบ ::
จะหน้าตาหรือระบบโต๊ะ เว็ป มือถือ ห้อยเอว ...สิ่งเหล่านี้ถูกพัฒนามาร่วมศตวรรษ กำลังจะถึงทางตัน
สิ่งที่เกิดขึ้นใหม่ก็ถูกดัดแปลงมาจากบรรพบุรุษทั้งนั้น...ในเชิงโปรแกรมมิ่ง ผมเองก็เลยไม่เหยียบมันมาก

แต่การนำเทคโนโลยีมาสร้างประโยชน์กับสิ่งใกล้ตัวเพื่อการดำรงชีวิตในช่วงบั้นปลาย หรือค้นหาในสิ่งแปลกใหม่ต่างหากคือเป้าหมายของผม

เช่น ทำยังไงจะหายตัวข้ามทะลุมิติ ย้อนเวลา หรืออนาคต การพิสูจน์สิ่งที่เป็นไปไม่ได้ การปลูกข้าวพลิกฝ่ามือ การรับส่ง รส กลิ่น ฯลฯ

เหล่านี้คือส่วนที่อยากรู้ อยากเห็น ต้องการมากๆ ซึ่งคงอีกนาน หรือบางเรื่องอาจเป็นไปไม่ได้เลย เมื่อเทียบกับ
พลังแฝงตามโบราณกาล ....



แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-18 11:39:38 By : lakornworld
 


 
ลองแล้ว Browser Brave พึ่งเคยได้ยินเหมือนกัน
ข้อดีคิดว่ามีแน่ แต่ตอนนี้ไม่มีเวลาดู เพราะต้อง
ออกแบบตาราง ระบบ เจ้าหนี้/ลูกหนี้

-- ผลลัพธ์ ปรกติ ดี แต่ตัวหนังสือ มันจะดูเล็กไปนิดหนึ่ง แต่ไม่ใช่ประเด็นสำคัญอะไร

brave_browser_test1
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-18 12:07:44 By : ผ่านมา
 


 

No. 130



โพสกระทู้ ( 210 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 129 เขียนโดย : ผ่านมา เมื่อวันที่ 2021-02-18 12:07:44
รายละเอียดของการตอบ ::
กราบงามๆ ครับ สำหรับข้อมูลที่ได้รับโดยไม่ต้องควักเอง

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-02-18 12:39:49 By : lakornworld
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ทำหน้า dashboard ให้เป็น realtime โดยใช้ ajax ตอนนี้เกิดปัญหา ขอคำแนะนำหน่อยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่