Viewing file: stationairport.php (5.09 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<? include 'index_IncludeAdmin.php'; $_SESSION['page'] = 'stationairport.php';
$Row = "SELECT * FROM stationairport"; $RowQuery = mysqli_query($con,$Row) or die ("Error Query [".$Row."]"); $Num_Rows = mysqli_num_rows($RowQuery); $Per_page = 100; $page = $_GET["page"]; if(!$_GET["page"]){ $page=1; } $Prev_page = $page-1; $Next_page = $page+1; $page_Start = (($Per_page*$page)-$Per_page); if($Num_Rows<=$Per_page){ $Num_pages =1; } else if(($Num_Rows % $Per_page)==0){ $Num_pages =($Num_Rows/$Per_page) ; } else{ $Num_pages =($Num_Rows/$Per_page)+1; $Num_pages = (int)$Num_pages; } $i=$page_Start+1;
$stationairport_SL = $Row." ORDER BY stationairport_id desc LIMIT $page_Start , $Per_page "; $stationairport_QR = mysqli_query($con,$stationairport_SL);
?>
<!DOCTYPE html> <html> <head> <? include 'index_Head.php'; ?> </head> <body> <? include 'index_Navbar.php'; ?> <div class="container-fluid"> <div class="row"> <div class="col-md-2" id="main-left"> <div class="row"> <div class="col-md-12"> <? include 'index_AdminMenu.php'; ?> </div> </div> </div> <div class="col-md-10"> <div class="row"> <div class="col-md-12"> <h3> จัดการ สถานี Airport </h3> <hr> </div> </div> <? include 'index_Alerts.php'; ?> <div class="row"> <div class="col-md-12 br-margin2"> <a href="stationairport_add.php" class="btn btn-success"> <span class="glyphicon glyphicon-plus-sign"></span> เพิ่ม สถานี Airport </a> </div> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <div class="row"> <div class="col-md-6"> สถานี Airport ทั้งหมด <span class="badge"> <? echo "$Num_Rows"; ?></span> <? if ($Num_Rows=='0') { ?> <span class="text-red"> คุณยังไม่มีข้อมูลนี้กรุณาเพิ่ม </span> <? } ?> </div> <div class="col-md-6 text-right" style="margin: -5px;"> <a class="btn btn-default" onclick="location.reload()"> รีเฟรชหน้า </a> <a class="btn btn-default" onclick="goBack()"> <span class="glyphicon glyphicon-backward"> </span> กลับ </a> </div> </div> </div> <div class="panel-body"> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th>#</th> <th> สถานี Airport </th> <th>รายละเอียด , แก้ไข , ลบ</th> </tr> </thead> <tbody class="row_position"> <? while ($stationairport = mysqli_fetch_array($stationairport_QR)) { ?> <tr id="<?php echo $stationairport['stationairport_id'] ?>"> <td><? echo $i; ?></td> <td> <? echo $stationairport[stationairport_name]; ?> </td> <td> <a href="stationairport_one.php?stationairport_id=<?php echo $stationairport[stationairport_id]; ?>" class="btn btn-primary"> <span class="glyphicon glyphicon-zoom-in"></span> รายละเอียด </a> <a href="stationairport_update.php?stationairport_id=<?php echo $stationairport[stationairport_id]; ?>" class="btn btn-info"> <span class="glyphicon glyphicon-edit"></span> แก้ไข </a> <a href="stationairport_del.php?stationairport_id=<?php echo $stationairport[stationairport_id]; ?>" onclick="return confirm(' ยืนยันการลบข้อมูล ? ')" class="btn btn-danger"> <span class="glyphicon glyphicon-trash"></span> ลบ </a> </td> </tr> <? $i++; } ?> </tbody> </table> </div>
</div> <div class="panel-footer"> <? include 'index_pagenum.php'; ?> </div> </div>
</div> <!-- 12 --> </div> <!-- row --> </div> <!-- 10 --> </div> <!-- row --> </div> <!-- container --> </body> <? $position = $_POST['position']; $stationairport_sort_i=1; foreach($position as $k=>$v){ $sql = "Update stationairport SET stationairport_sort=".$stationairport_sort_i." WHERE stationairport_id =".$v; $mysqli->query($sql); $stationairport_sort_i++; } ?> <script type="text/javascript"> $( ".row_position" ).sortable({ delay: 150, stop: function() { var selectedData = new Array(); $('.row_position>tr').each(function() { selectedData.push($(this).attr("id")); }); updateOrder(selectedData); } }); function updateOrder(data) { $.ajax({ url:"stationairport.php", type:'post', data:{position:data}, success:function(){ } }) } </script> </html>
|