ทำหน้า dashboard ให้เป็น realtime โดยใช้ ajax ตอนนี้เกิดปัญหา ขอคำแนะนำหน่อยครับ
copy เค้ามาไม่ได้อ่านคนคอมเม้นหรอครับว่า Error ??
ลองใส่ type: "POST", Or GET
ประวัติการแก้ไข 2021-01-25 12:01:41
Date :
2021-01-25 12:01:20
By :
Genesis™
ดู console.log ครับ...
ถ้าให้เดาน่าจะเจอประมาณนี้ '$' is undefined (เพราะไม่มี header include)
ถ้าใช่ ต้องโหลด jQuery library ตรง head tag ก่อน
Date :
2021-01-29 14:27:08
By :
lakornworld
อ่าว โทษทีผมไม่ได้เลื่อนดู เพราะภาพใหญ่กว่าหน้าจอ
แต่ยังไงลองเปลี่ยนเป็นแบบนี้ดูครับ
Code (JavaScript)
<script src="https://code.jquery.com/jquery-3.5.1.min.js">
Date :
2021-01-29 15:06:46
By :
lakornworld
ไม่งั้นในหน้า dashboardcms ได้โหลด jQuery หรือไม่
Date :
2021-01-29 16:51:39
By :
lakornworld
ตอบความคิดเห็นที่ : 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
ตอบความคิดเห็นที่ : 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
ผลลัพธ์
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
var $ = jQuery.noConflict();
ใส่ก่อนจะใช้ $
Date :
2021-02-01 11:03:08
By :
mr.v
งงยังไงครับ?
ก็ก่อนที่จะเรียกใช้ $ ตรงไหน ก็เอาไปใส่ในบรรทัดก่อนนั้น
แค่นี้เอง
แล้วถ้าอยากจะรู้ว่าถูกไหม ก็ลองใส่แล้ว refresh หน้าดูว่า $.ajax หรือ $.xxx is not function มันหายไหม
ถ้าหายแสดงว่าใส่ถูก ถ้าไม่หายแสดงว่าใส่ผิด
ก็มีเท่านี้เองทำไมไม่ลองดูล่ะครับ
Date :
2021-02-01 18:08:41
By :
mr.v
ผมเล่าให้ฟัง ผมไม่ได้แนะนำคุณ @Tor
ต่อให้คุณเป็นนักศึกษา หรือคุณจบดอกเตอร์ ผมก็อยากเล่าให้ฟังอยู่ดี
ยกเว้น คุณท่านที่กระผมเคารพไม่จบ ป.4 ผมถึงไม่กล้าเล่าให้ฟัง
คงต้องรบกวนท่าน @ละครชีวิต แสดงให้จบ
คงต้องรบกวนท่าน @Chaidhanan แสดงให้จบ
ปล. ผมไม่ได้ว่าอะไรถูกอะไรผิดหรอกนะ แต่ผมคิดว่า คุณใช้ความคิด/อื่นฯ มากกว่าระบบบัญชีของผมเสียอีก
Date :
2021-02-02 13:42:27
By :
ผ่านมา
ตอนนี้บอกได้อย่างเดียว จัดลำดับ event การเรียกใช้งานให้ถูก
event ควรนำไปไว้หลังสุด เช่น setTimeout() มันควรเรียกใช้งาน เมือน document โหลดเสร็จหมดแล้ว
และแบ่งไฟล์ แยกเป็นส่วนๆ html มันมี head มี body
มี include <link> <script src="">
ส่วนที่เป็น php กับ html ก็ควรแยกจากกัน
ก็แยกมันหน่อย จับมันมารวมกัน ผสมปนเป แก้ลำบาก อ่านก็ยาก
Date :
2021-02-02 15:44:54
By :
Chaidhanan
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 :
ผ่านมา
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
ปล. จะใช้โค๊ดอะไรยังไง เปิด document มันหน่อยนะครับ อย่าคิดว่าตัวเอง เป็นอัจฉริยะ อ่านโค๊ดแล้วจะเข้าใจไปทุกโค๊ด
ถ้าไม่เข้าใจก็ต้องหาเปิดอ่าน มันไม่ได้มีแค่ สิ่งที่คุณต้องการ ณ เวลานั้น แต่มันจะมีสิ่งที่คุณควรรู้ เพื่ออนาคตอย่างอื่น อยู่ด้วย
Date :
2021-02-03 08:51:34
By :
Chaidhanan
@Tor
Same Page ก็ใส่ได้ (ใส่/ไม่ใส่ ก็มีค่าเท่ากัน)
มันใจเหรอว่า setInterval(function(){
//Loop สามล้านรอบ
}, interval); มันจะไม่ Timeout.
ถามว่า ควรใส่ไหม? เหมือนแม่คนหนึ่งมีลูกสาว 3 คน ลูกชาย 1 คน แม่จำลูกตัวเองได้เสมอ โดยไม่จำเป็นต้องตั้งชื่อ
ลูกสาวคนโตอายุ 12 ปี (อีหล้า )
ลูกชายคนกลาง อายุ 8 ปี (บักหำ )
ลูกสาวคนโต : หนูอายุ พึ่งจะ สิบสอง เองนะค่ะ แม่
แม่ : เออ ข้าเห็นเอ็งพา ผัว เข้าบ้านมา 5 คนล่ะ อีห่าหล้า
ปล. กลับไปอ่าน #NO 31 ให้เข้าใจ สักแต่คิดว่าเข้าใจ
Date :
2021-02-03 10:19:11
By :
ผ่านมา
ปล. ความรู้ไม่มีวันสิ้นสุด ตราบลมหายใจสุดท้าย
Date :
2021-02-03 10:37:25
By :
ผ่านมา
@Tor
#NO 33 สำหรับเรา คือ ตำรา PHP ฉบับ สมบูรณ์ เลยเชียวแหละ
ดูดีดี คนที่สรุป PHP ออกมาได้อย่างนี้ ไม่ธรรมดาคน
Date :
2021-02-03 10:53:44
By :
ผ่านมา
ตอบความคิดเห็นที่ : 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 ตลอดครับ
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
@ละครชีวิต
อันใบตองพันห่อปลาร้าได้ ฉันใด
จิตมนุษย์นั่นไซร์ยากแท้ หยั่งถึง
สะแลงฟ้าบ่งบอกถึง จริงแท้ สูงส่ง
สะแลงดินบ่งบอกถึง ที่แท้ ตนเอง
ลูกศิษย์ท่าน อังคาร กัลยาณพงค์
เวลา : ลิบลิบ ไกลโพ้น เลยเส้นขอบฟ้านั่น
Date :
2021-02-03 12:51:32
By :
ผ่านมา
เวลาไม่ตรง กับปัจจุบัน เพราะไม่ได้เซท 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...)
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 )
Date :
2021-02-03 14:06:47
By :
ผ่านมา
เห็นคำถาม สุดท้ายแล้ว บ่งบอกให้รู้ว่า ยังไม่เข้าใจว่า 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
วิเคราะห์โค๊ดหน่อยครับ ผมก็อธิบายไว้แล้ว มีการเพิ่มเติม รูปแบบการส่ง 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
ปล. แนะนำโปรแกรมช่วยการเขียนโปรแกรม 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 :
ผ่านมา
โปรแกรมผมก็ใช้ 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
ไม่ง่ายที่คิดจะเริ่มทำอะไร ของเดิมมันก็ดีอยู่แล้ว ค้ำคออยู่
เอา 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 :
ผ่านมา
ยังไม่เลิกเอาส่วนที่เป็น text มาแสดงเป็นภาพ อีกเหรอครับ
และอะไรที่แก้ไขแล้ว ก็เอามาดูด้วย จะได้รู้ว่าแก้ถูก
เวลาครูบอกให้แก้งาน ตอนส่งงานที่แก้ส่งด้วยปากเปล่าหรือเปล่า
บอกครูว่า ผมแก้แล้วครับ ครูเขาจะให้ผ่านไหม
และไอ้ card location ใช้ class อะไรเขียน วฺิธีแก้ไข ก็ต้องไปอ่าน document ของ เครื่องมือที่เราใช้ให้ดี
Date :
2021-02-04 17:57:25
By :
Chaidhanan
ตอบความคิดเห็นที่ : 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
ภาพที่ 4
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
มีเม้นท้ข้างบนเขาเตือนเรื่อง 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
เวลามันหายไปไหนหว่า?
หรือว่า ชีวิตคนเรามัน สั้นนัก ไปไม่ถึงหนทางนั้น
หลับหูหลับตาทำฯไป ค่อยมาแก้ไขคำ (กรองคำ/รองรับหลากหลายภาษา) ภายหลัง
Date :
2021-02-05 14:54:52
By :
ผ่านมา
@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 :
ผ่านมา
setIterval ทำไปเรื่อยๆ เครื่อง server ค้าง ก็ยังทำงานอยู่
setTimeout ตั้งเวลาใหม่ เมื่อทำเสร็จ
เปลี่ยนแปลงนิดหน่อย วิเคราะโค๊ดทีผมทำเป็นตัวอย่าง
แนะนำให้ใช้ setTimeout มันเปลี่ยนแปลงกำหนดค่าต่างๆ เป็น dynamic มากกว่า
Date :
2021-02-05 18:09:40
By :
Chaidhanan
จะใช้ 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 :
ผ่านมา
ตอบความคิดเห็นที่ : 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
เอา js มาปนกับ php มันแบบนั้นเลย?
แล้วมันจะทำงานได้มั้ย?
เคยทดลองรันดูมั้ยว่าผลมันเป็นยังไง? หรือว่าถามแล้วรอคำตอบอย่างเดียว?
คุณลองอ่านคห. 51 ให้เข้าใจแตกฉานซะก่อนดีกว่านะ ดูแล้วภาษาไทยก็ยังสื่อสารเหมือนจะไม่รู้เรื่องกันเท่าไหร่
Date :
2021-02-07 00:45:43
By :
mr.v
ตอบความคิดเห็นที่ : 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
ข้างบนก็บอกอยู่แหมบๆว่าอย่าเอา php ไปปนกันกับ javascript
เอาแค่นี้ก่อน กลัวบอกมากจะไม่เข้าใจอีก
แค่นี้พอได้ไหม? ไม่ปนกันน่ะ php, js
Date :
2021-02-09 19:33:00
By :
mr.v
ตอบความคิดเห็นที่ : 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
ตอบความคิดเห็นที่ : 82 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-10 05:43:15
รายละเอียดของการตอบ ::
ขอบคุณครับพี่ Chaidhanan
ข้อมูลไม่แสดงครับ
1.ผมกำหนด id แล้ว <div id="object_datetime"></div>
2.code php ผมย้ายไปไว้ในส่วนของการรับ request อยู่ใน switch( $_POST['rev'] )
ภาพที่ 1
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
ดูตรง 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 ไม่ใช่ว่ามันไม่ดี แต่ มันดีเกินไป สำหรับผม (ผมใช้นิดเดียว)
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 :
ผ่านมา
ตอบความคิดเห็นที่ : 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
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 :
ผ่านมา
<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
pusher free เถอะ
Date :
2021-02-11 11:43:56
By :
guest
ตอบความคิดเห็นที่ : 91 เขียนโดย : Chaidhanan เมื่อวันที่ 2021-02-11 10:36:32
รายละเอียดของการตอบ ::
พี่ Chaidhanan ครับ
ผมแก้ไข
1.กำหนดชื่อ id ตรงกับชื่อ object แล้วครับ ข้อมูลยังไม่แสดงข้อมูลครับ แต่มีการโหลดเข้ามาครับ การแสดงผลเพี้ยนครับ
ภาพที่ 1
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 :
ผ่านมา
<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
ตอบความคิดเห็นที่ : 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
ข้างบน #30 บอกเรื่องการจัดสัดส่วน อะไรอยู่ตรงไหน ก็ดูเหมือนไม่ได้อ่านเลยสักนิดเดียว
ยังดันทุรังเอา stylesheet ยัดมันลงไปใน body อยู่นั่น....
อยากจะแนะนำให้แยกไฟล์ไปเลยนะ css, js ไปส่วนนึงเลย อะไรงี้ให้โค้ดมันดูง่ายสบายตา แต่เห็นอ่านภาษาไทยก็ยังอ่านไม่รู้เรื่องหรือไม่อ่านก็ไม่รู้ เลยท้อใจที่จะบอกซะแล้ว
Date :
2021-02-12 00:59:26
By :
mr.v
tag เปิดแล้วก็ต้องปิด มันมีความสำคัญ ถ้าไม่ปิด ขอบเขตมันกว้าง ข้อความบางอย่างก็อาจจะหายไปได้
<span>xxxxx</span> แบบ hard code กำหนดข้อความเลย
หรือ
<span /> แบบรอ runtime ใส่ข้อมูลที่หลัง
Date :
2021-02-12 06:52:16
By :
Chaidhanan
@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 :
ผ่านมา
ดูเหมือนไม่มีอะไร แต่ก็ดีใจที่ถอด Bootstrap ออกได้โดยสมบูรณ์
สำหรับคนอื่นฯ อาจจะมองว่ามันง่ายในความง่ายฯ เอง
แต่สำหรับเรา มันยากถึงยากมาก เลยเชียวแหล่ะ
Date :
2021-02-14 03:37:25
By :
ผ่านมา
ตัวอย่าง 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
ที่มันทำงานแค่ date เพราะ condition สีแดง เฉพาะ 1
if (isset($_POST['rev']) && $_POST['rev'] == 1 ) {
Date :
2021-02-14 05:04:28
By :
Chaidhanan
@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 :
ผ่านมา
ผมจัด 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
แยกออกเป็นส่วนๆแล้ว 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
เอาใส่เรียบร้อยแล้ว Limitless ตามที่ท่าน Chainahan แนะนำ เราได้ข้อสรุปว่า
ไม่ทิ้งของเดิม BootStrap 4 และเฉพาะกรอบสีแดงใช้ของใหม่ FuckStrap 0.1
เราใช้เวลาเดือนกว่าฯ ศึกษาเทคโนโลยีใหม่ฯ ทุกฯตัว เลยน่ะ ไล่ตั้งแต่
React Native
Flutter Native
Vue 3 lastest
Angular lastest
และอื่นฯอีก หมดโลกเลยมั้ง
ในที่สุดก็ได้ข้อสรุปที่ลงตัว ลดการเขียน Source code ลงไปได้มากโข (เราคิดว่าเกิน 70% เลยนะ)
เราเป็น SA/Programmer ในคนคนเดียวกัน
เราไม่ได้ดีแต่พูด
Date :
2021-02-18 08:11:09
By :
ผ่านมา
ระดับนี้แล้ว ละเอียดรอบคอบ ทดสอบหลายร้อยรอบ
แต่ไม่ว่าจะใช้อะไรก็ไม่ส่งผลกับ FuckStrap 0.1 ได้หรอก
เหตุผล CSS มันขึ้นด้วย ไม่มีทางซ้ำได้เลย
(ทำเป็น Isolation CSS)
Code (PHP)
FuckStrap_wrapper
FuckStrap_header
FuckStrap_sidebar_l
FuckStrap_sidebar_r
FuckStrap_content
FuckStrap_footer
Date :
2021-02-18 10:40:37
By :
ผ่านมา
@lakornworld
เป้าหมายของผมไม่ใช่เวป ไม่ใช่แค่มือถือ หรือการเขียนโปรแกรมอะไรเลย
ผมคิดว่า โปรแกรม ใครฯก็เขียนได้ ไม่เก่งวันนี้ วันข้างหน้าเดี๋ยวมันก็เก่งขึ้นเองแหละ
แต่ผมจะไปวัดและไปสู้ ในสนาม ใครออกแบบระบบ และรู้จริง มากกว่ากัน ต่างหาก
(น้อยมากนะในเมืองไทยนี้)
ปล. ผมมองไกลมาก ไกลโขเลยเชียวแหละ
Date :
2021-02-18 10:57:36
By :
ผ่านมา
ลองแล้ว Browser Brave พึ่งเคยได้ยินเหมือนกัน
ข้อดีคิดว่ามีแน่ แต่ตอนนี้ไม่มีเวลาดู เพราะต้อง
ออกแบบตาราง ระบบ เจ้าหนี้/ลูกหนี้
-- ผลลัพธ์ ปรกติ ดี แต่ตัวหนังสือ มันจะดูเล็กไปนิดหนึ่ง แต่ไม่ใช่ประเด็นสำคัญอะไร
Date :
2021-02-18 12:07:44
By :
ผ่านมา
Load balance : Server 02