|
|
|
สอบถามปัญหาเกี่ยวกับ การค้นหา และการ แบ่งหน้า ครับ |
|
|
|
|
|
|
|
ก่อนหน้านี้ค้นหาได้ปกติ แต่พอใส่แบ่งหน้าเข้าไปก็ใช้งานค้นหาไม่ได้ครับ
รบกวนผู้รู้ชี้แนะตรวจสอบให้ทีครับ
ขอบคุณครับ
Code (PHP)
<?php ob_start(); ?>
<?php
require ('connect.php');
session_start();
if ($_SESSION['User_id'] == "") {
header("Content-type: text/html; charset=utf-8");
echo "<script language='JavaScript' >";
echo "alert('กรุณากรอกข้อมูลเพื่อเข้าสู่ระบบ');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=index.php' />";
exit();
}
if ($_SESSION['Usertype_id'] != "1") {
//echo "This page for Admin only!";
echo "<meta http-equiv='refresh' content='0;url=logout.php'>";
exit();
}
$strSQL = "SELECT * FROM tb_user WHERE User_id = '" . $_SESSION['User_id'] . "' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="stylesheet" href="bootstrap/css/footer.css">
<link rel="stylesheet" href="bootstrap/css/base.css">
<link rel="stylesheet" href="bootstrap/css/skeleton.css">
<link rel="stylesheet" href="bootstrap/css/layout.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="bootstrap/css/bootstrap.css" rel="stylesheet"/>
<link type"text/css" rel="Stylesheet" href="bootstrap/css/bootstrap.css" />
<meta charset="UTF-8">
<div class="container">
<title>Help Desk Management</title>
</head>
<style type="text/css">
div#mylayout_1{
display:block;
width:300px;
/*border:1px solid #09C;
background-color:#CFC;*/
word-wrap:break-word;
}
</style>
<body>
<div class="row clearfix">
<div class="col-md-12 column">
</div>
</div>
<div class="row clearfix">
<div class="col-md-12 column">
</div>
</div>
<div class="row clearfix">
<div class="col-md-12 column">
</div>
</div>
<div class="col-md-12 column">
<h3></h3>
</div>
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="panel-title">
<h1><a href="helpdesk_add.php"><img src="img/branner.png" title="Open Ticket Click Here" width="533" height="115"></a></h1>
</div>
<?php include ("navbartop.php"); ?>
<form name="frmSearch" method="GET" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<?php
$strSQL = " SELECT * FROM tb_gadget,tb_priority,tb_issue,tb_status
where
tb_gadget.Gadget_id
AND
tb_gadget.priority_tb = tb_priority.priority_id
AND
tb_gadget.issue_tb = tb_issue.issue_id
AND
tb_gadget.status_tb = tb_status.status_id";
if (isset($_GET['ddlSelect'])!= "" and $_GET["txtKeyword"] != '')
{
$strSQL .= " AND (".$_GET["ddlSelect"]." LIKE '%".$_GET["txtKeyword"]."%' ) ";
}
$objQuery = mysql_query($strSQL .=" ORDER BY Gadget_id DESC") or die ("Error Query [".$strSQL."]");
?>
<?php
require ('connect.php');
$strSQL = " SELECT * FROM tb_gadget,tb_priority,tb_issue,tb_status
where
tb_gadget.Gadget_id
AND
tb_gadget.priority_tb = tb_priority.priority_id
AND
tb_gadget.issue_tb = tb_issue.issue_id
AND
tb_gadget.status_tb = tb_status.status_id";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 2; // Per Page
$Page = isset($_GET['Page']) ? $_GET['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;
}
$strSQL .=" order by Gadget_id DESC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
<table width="Auto" border="1">
<tr>
<th height="50"> <span class="col-sm-0"> </span>
<span class="col-sm-3">
<select style="color:#3399FF" class="form-control" name="ddlSelect" id="ddlSelect" title="Click Select Item">
<option value="Gadget_id" <?if($_GET["ddlSelect"]=="Gadget_id"){echo"selected";}?>TICKET_ID</option>
<option value="ticket_date" <?if($_GET["ddlSelect"]=="ticket_date"){echo"selected";}?>TICKET_DATE</option>
<option value="department_users" <?if($_GET["ddlSelect"]=="department_users"){echo"selected";}?>DEPARTMENT</option>
<option value="priority_type" <?if($_GET["ddlSelect"]=="priority_type"){echo"selected";}?>PRIORITY</option>
<option value="issue_type" <?if($_GET["ddlSelect"]=="issue_type"){echo"selected";}?>ISSUE</option>
<option value="name_user" <?if($_GET["ddlSelect"]=="name_user"){echo"selected";}?>NAME</option>
</select>
</span><span class="col-sm-3">
<input style="color:#3399FF" name="txtKeyword" type="text" placeholder="Search" id="txtKeyword"onFocus="this.value = ''" title="Please Fill Search Message">
</span><span class="col-sm-1">
<button type="submit" title="Click Search" class="btn btn-primary"><span class="glyphicon glyphicon-search">Search</span> </button>
</span></th>
</tr>
</table>
<table width="140%" class="table table-hover">
<span class="label label-default" title="ยังไม่กำหนด">Undefined</span>
<span class="label label-info" title="รอดำเนินการ">Waiting</span>
<span class="label label-success" title="กำลังดำเนินการ">On Process</span>
<span class="label label-warning" title="ปิดงานระหว่างกาล">Closed-Interim</span>
<span class="label label-danger" title="ปิดงานระยะยาว">Closed-Longterm</span>
<span class="label label-primary" title="ส่งไปยังผู้จัดจำหน่าย">Sent To Supplier</span>
<thead>
<th width="9%"><div align="center"><strong>Ticket ID</strong></div></th>
<th width="5%"><div align="center"><strong>DATE </strong></div></th>
<th width="9%"><div align="center"><strong>PRIORITY</strong></div></th>
<th width="9%" align="center"><div align="center"><strong>ISSUE</strong></div></th>
<th width="28%"><div align="center"><strong>QUESTION</strong></div></th>
<th width="9%"><div align="center"><strong>DEPARTMENT</strong></div></th>
<th width="10%"><div align="center"><strong>NAME</strong></div></th>
<th width="7%" align="center"><div align="center"><strong>STATUS</strong></div></th>
<th width="9%" align="center" valign="middle"><div align="center"><strong>MANAGE</strong></div></th>
</tr>
</thead>
<tbody>
<?php
while ($objResult = mysql_fetch_array($objQuery)) {
?>
<tr>
<td height="42"><span class="label <?php echo $objResult["status_code"];?>">T<?php echo $objResult["ticket_date"];?>.<?php echo $objResult["Gadget_id"]; ?></span></td>
<td> <?php echo $objResult["date_time"]; ?></td>
<td> <?php echo $objResult["priority_type"]; ?></td>
<td> <?php echo $objResult["issue_type"]; ?></td>
<td><div id="mylayout_1"><?php echo $objResult["user_question"]; ?></div></td>
<td><?php echo $objResult["department_users"]; ?></td>
<td><?php echo $objResult["name_user"]; ?></td>
<td><span class="label <?php echo $objResult["status_code"];?>"> <?php echo $objResult["status_type"]; ?></td>
<td><a href="helpdesk_view.php?view_id=<?php echo $objResult['Gadget_id']; ?>">
<button type="button" class="btn btn btn-primary" title="Open Ticket"> <span class="glyphicon glyphicon-folder-open"></span> </button>
<a href="helpdesk_edit.php?edit_id=<?php echo $objResult['Gadget_id'];?> ">
<button type="button" class="btn btn btn-info" title="Manage Ticket"> <span class="glyphicon glyphicon-cog"></span> </button>
</a></td>
</tr>
<?php
}
?>
</table>
<br>
Total <?php echo $Num_Rows;?> Record : <?php echo $Num_Pages;?> Page :
<?php
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
}
mysql_close($objConnect);
?>
</tbody>
</table>
<meta http-equiv="refresh" content="60;url=Mainpage.php">
<?php include ("footer.php"); ?>
<script src="bootstrap/js/jquery.js"></script>
<script src="bootstrap/js/bootstrap-datepicker.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
<script>window.jQuery || document.write("<script src='js/jquery-1.5.1.min.js'>\x3C/script>")</script>
<script src="js/app.js"></script>
</body>
</html>
Tag : PHP, MySQL
|
ประวัติการแก้ไข 2015-08-16 23:40:36 2015-08-17 10:34:14
|
|
|
|
|
Date :
2015-08-16 21:58:12 |
By :
unicorn51 |
View :
951 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2015-08-16 23:59:06 |
By :
CasanovaKung |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2015-08-17 10:21:32 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2015-08-17 13:10:29 |
By :
unicorn51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|