Quote:ถ้าจะนับจำนวนข้อมูลที่เพิ่มในแต่ละหน้า
$query_temple1 = "SELECT COUNT(ID) FROM borrowreturn ORDER BY StartDate ASC" or die("Error:" . mysqli_error()); $result1 = mysqli_query($con, $query_temple1); <?php $cdate = date('Y-m-d'); echo ' <table id="example1" class="table table-bordered table-striped">'; echo "<thead style='color:#FFFFFF; text-align:center;'>"; echo "<tr class='info'> <th width='5%'>ลำดับ</th> <th width='10%'>ชื่อโครงการ</th> <th width='7%'>วันที่เริ่ม</th> <th width='7%'>วันสิ้นสุด</th> <th width='7%'>sum</th> </tr>"; echo "</thead>"; $cddd = strtotime($r["EndDate"])-strtotime($cdate); while($s = mysqli_fetch_array($result1)) { while($r = mysqli_fetch_array($result)) { $a = strtotime($r["EndDate"])-strtotime($cdate); $a = ($a)/(60*60*24); if($a<0){ $mstatus = 'เกินระยะเวลา';} else if ($a==0){$mstatus = 'ครบกำหนดดำเนินการ';} else{ $mstatus ='อยู่ระหว่างดำเนินการ';} if($mstatus == 'อยู่ระหว่างดำเนินการ'){ echo "<tr><td> <font color=\"#000000\">" .$r["ID"] . "</font></td> "; echo "<td> <font color=\"#000000\">" .$r["project_name"] ." </font></td> "; echo "<td><font color=\"#000000\">"; echo date('d/m/Y',strtotime($r["StartDate"])); echo "</font></td>"; echo "<td> <font color=\"#000000\">";echo date('d/m/Y',strtotime($r["EndDate"])); echo "</font></td>"; $sm = $r = COUNT(ID) ; echo "<td>" .$sm. "</td>"; ?>
$count = 0; while ($s = mysqli_fetch_array($result1)) { while ($r = mysqli_fetch_array($result)) { //... if ($mstatus == 'อยู่ระหว่างดำเนินการ') { //.. $count++; } } } echo $count;
<button type="button">อยู่ระหว่างดำเนินการ <?PHP echo $count; ?></button>
<li> <a href="yellow.php" class="button2 clickmenu">ครบกำหนดดำเนินการ<?PHP echo $count; ?> </a> <li> <a href="black.php" class="button2 clickmenu">อยู่ระหว่างดำเนินการ</a> </li> <li> <a href="red.php" class="button2 clickmenu">เกินระยะเวลา</a> </li>
session_start(); // ควรวางไว้บรรทัดแรกๆ //... $_SESSION["count"] = $count;
<li> <a href="yellow.php" class="button2 clickmenu">ครบกำหนดดำเนินการ<?PHP echo isset($_SESSION["count"]) ? $_SESSION["count"] : ""; ?> </a> <li> <a href="black.php" class="button2 clickmenu">อยู่ระหว่างดำเนินการ</a> </li> <li> <a href="red.php" class="button2 clickmenu">เกินระยะเวลา</a> </li>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง