|
 |
|
Loop while ซ้อนกับ Loop while ช่วยดูให้หน่อยครับ ทำไมถึงออกเป็นแบบนี้ |
|
 |
|
|
 |
 |
|
ช่วยดูให้หน่อยครับ ทำไมถึงออกมาเป็นแบบนี้

Code (PHP)
<table width="100%">
<tr>
<th colspan="5" height="40px">มีนาคม พ.ศ. 2561</th>
</tr>
<tr>
<th width="15%">วันที่</th>
<th width="25%">ช่วงเช้า</th>
<th width="25%">ช่วงบ่าย</th>
<th width="25%">ช่วงดึก</th>
<th width="10%">สถานะ</th>
</tr>
<?php
$sqlDayofMonth = $mySqli->query("SELECT DayID,nDay,nMonth,nYear FROM dayofmonth WHERE nMonth = 1 AND nYear = 2561");
$MonthFull = Array(
"",
"มกราคม",
"กุมภาพันธ์",
"มีนาคม",
"เมษายน",
"พฤษภาคม",
"มิถุนายน",
"กรกฎาคม",
"สิงหาคม",
"กันยายน",
"ตุลาคม",
"พฤศจิกายน",
"ธันวาคม");
while($resultDayofMonth = mysqli_fetch_array($sqlDayofMonth)){
$Month = $resultDayofMonth["nMonth"];
$MonthTH = $MonthFull[$Month];
$DayID = $resultDayofMonth["DayID"];
echo "<tr><td>" . $resultDayofMonth["nDay"] . " " . $MonthTH . " " . $resultDayofMonth["nYear"] . "</td>";
$SqlDuration = $mySqli->query("SELECT id_durday FROM durationofday WHERE DayID = $DayID");
while ($ResultDur = mysqli_fetch_array($SqlDuration)) {
echo "<td>" .$ResultDur['id_durday']. "<button class='edit_manage'>แก้ไข</button></td>";
}
echo "<td><i class='fa fa-close' style='color:red;font-size:32px'></td>";
echo "</tr>";
}
echo "</table>";
?>
Tag : PHP, HTML, XAMPP

|
ประวัติการแก้ไข 2018-04-05 01:14:34
|
 |
 |
 |
 |
Date :
2018-04-05 01:12:46 |
By :
amateur01 |
View :
3186 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วงวันที่แรกๆ ใน loop แรก อาจไม่มีข้อมูล มันเลยไม่สามารถแสดงข้อมูลใน loop ที่สองครับ
|
 |
 |
 |
 |
Date :
2018-04-05 06:24:49 |
By :
deawx |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|