หากต้องการเพิ่มข้อมูลในเทเบิล A ซึ่งมี ID Name Lname Age Sex ไปในฐานข้อมูล แล้วจะทำยังไงให้หน้าโปรแกรมแสดงข้อมูลเฉพาะ ID ให้ขึ้นโชว์ว่าอยู่ตำแหน่งไหน
หากมีขนาดตาราง เช่น 5x5 มีแนวทางหรือข้อมูลให้ศึกษาไหมครับ พวกการแสดงผลของข้อมูล
แนวทางสร้าง การจัดเก็บแบบระบุตำแหน่ง
Moderator: mindphp, ผู้ดูแลกระดาน
-
- PHP Newbie
- โพสต์: 9
- ลงทะเบียนเมื่อ: 25/04/2020 11:01 pm
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41377
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: แนวทางสร้าง การจัดเก็บแบบระบุตำแหน่ง
ไม่เข้าใจคำถามครับแล้วจะทำยังไงให้หน้าโปรแกรมแสดงข้อมูลเฉพาะ ID ให้ขึ้นโชว์ว่าอยู่ตำแหน่งไหน
ลองสือสารด้วยภาพ ประกอบคำอธิบาย
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Newbie
- โพสต์: 9
- ลงทะเบียนเมื่อ: 25/04/2020 11:01 pm
Re: แนวทางสร้าง การจัดเก็บแบบระบุตำแหน่ง
เวลาเพิ่มข้อมูลให้แสดงผลประมาณนี้ครับว่าข้อมูลอยู่ในตำแหน่งไหนครับ มีแนวทางให้ศึกษาไหมครับ
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41377
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: แนวทางสร้าง การจัดเก็บแบบระบุตำแหน่ง
ระบุพิกัด x,y ในการเก็บและเอามาแสดง
ศึกษาการใช้ css, html table ครับ
ศึกษาการใช้ css, html table ครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Newbie
- โพสต์: 9
- ลงทะเบียนเมื่อ: 25/04/2020 11:01 pm
Re: แนวทางสร้าง การจัดเก็บแบบระบุตำแหน่ง
ต้องการ search แค่ LabNo แล้วขึ้นแสดงผลตาม Labno ที่ search
ทำเป็น popup
พอ search จะแสดงข้อมูลเป็น popup อีกที
โค้ด: เลือกทั้งหมด
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
font-family: Arial;
}
* {
box-sizing: border-box;
}
.openBtnn {
position: fixed;
top : 90%;
left : 80%;
background: #f1f1f1;
border: none;
padding: 10px 15px;
font-size: 20px;
cursor: pointer;
}
.openBtnn:hover {
background: #bbb;
}
.overlay {
height: 50%;
width: 50%;
display: none;
position: fixed;
z-index: 1;
top: 50%;
left: 50%;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0, 0.9);
}
.overlay-content {
position: relative;
top: 46%;
width: 80%;
text-align: center;
margin-top: 30px;
margin: auto;
}
.overlay .closebtn {
position: absolute;
top: 0px;
right: 45px;
font-size: 60px;
cursor: pointer;
color: white;
}
.overlay .closebtn:hover {
color: #ccc;
}
.overlay input[type=text] {
padding: 15px;
font-size: 17px;
border: none;
float: left;
width: 80%;
background: white;
}
.overlay input[type=text]:hover {
background: #f1f1f1;
}
.overlay button {
float: left;
width: 20%;
padding: 16.25px;
background: #004d00;
font-size: 17px;
border: none;
cursor: pointer;
}
.overlay button:hover {
background: #bbb;
}
</style>
</head>
<body>
<div id="myOverlay" class="overlay">
<span class="closebtn" onclick="closeSearch()" title="Close Overlay">×</span>
<div class="overlay-content">
<input type="text"method="post" name="lab">
<button id="myBtnm"><i class="fa fa-search" ></i></button>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
/* The Modal (background) */
.modalb {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modalb-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width:58%;
}
/* The Close Button */
.close {
color: red;
float: right;
font-size: 35px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<!-- The Modal -->
<div id="myModalb" class="modalb">
<!-- Modal content -->
<div class="modal-content">
<?php
$serverName = "localhost";
$userName = "root";
$userPassword = "root1234";
$dbName = "login_db";
$conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$lab = $_POST['lab'];
$sqlvv = "SELECT * from rack "; //ตรงนี้ลองหลายแบบแล้วไม่ได้
$objQuery = mysqli_query($conn, $sqlvv) or die("Error Query [" . $sqlvv . "]");
?>
<table border="1">
<tr>
<th width="50">
<div align="center">Rackname</div>
</th>
<th width="50">
<div align="center">LabNo</div>
</th>
<th width="50">
<div align="center">Position</div>
</th>
<th width="100">
<div align="center">Work</div>
</th>
<th width="100">
<div align="center">Fname</div>
</th>
<th width="100">
<div align="center">Lname</div>
</th>
<th width="100">
<div align="center">Age</div>
</th>
<th width="100">
<div align="center">Sex</div>
</th>
</tr>
<?php
while ($objResult = mysqli_fetch_array($objQuery)) {
?>
<tr>
<td><?php echo $objResult["rackname"]; ?></td>
<td><?php echo $objResult["LabNo"]; ?></td>
<td><?php echo $objResult["Position"]; ?></td>
<td><?php echo $objResult["Work"]; ?></td>
<td><?php echo $objResult["Fname"]; ?></td>
<td><?php echo $objResult["Lname"]; ?></td>
<td><?php echo $objResult["Age"]; ?></td>
<td><?php echo $objResult["Sex"]; ?></td>
</tr>
<?php
}
?>
</table>
<?php
mysqli_close($conn); // ปิดฐานข้อมูล
?>
</div>
</div>
</div>
</div>
<script>
// Get the modal
var modalb = document.getElementById("myModalb");
// Get the button that opens the modal
var btn = document.getElementById("myBtnm");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modalb.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modalb) {
modalb.style.display = "none";
}
}
</script>
</body>
</html>
</div>
</div>
</form>
<button class="openBtnn" onclick="openSearch()">Open Search Box</button>
<script>
function openSearch() {
document.getElementById("myOverlay").style.display = "block";
}
function closeSearch() {
document.getElementById("myOverlay").style.display = "none";
}
</script>
</body>
</html>
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 130