|
|
|
ดึงรายการแบบ realtime พร้อมแบ่งหน้า ด้วย ajax ร่วมกับ PHP Oracle pagination |
|
|
|
|
|
|
|
อยากได้โค๊ด dropdown list ของ oracle เขียนแบบไหนค่ะ
|
|
|
|
|
Date :
2017-03-30 11:52:29 |
By :
dydy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
สอบถามเพิ่มเติมน่ะค่ะ หน้า1 แสดงผล
แต่พอกด หน้าที่ 2 มันerror ค่ะ ต้องเพิ่มเติมส่วนไหนค่ะ
|
ประวัติการแก้ไข 2017-04-03 22:06:37 2017-04-03 22:11:45
|
|
|
|
Date :
2017-04-03 22:01:49 |
By :
dydy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไฟล์ list.php
........................
Code (PHP)
<html>
<head>
<link rel="shortcut icon" href="img/hh.png">
<title>List Ward</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/lumen/bootstrap.min.css">
<link rel="stylesheet" href="https://daneden.github.io/animate.css/animate.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<?php
$strKeyword = null;
if(isset($_POST["NameWard"]))
{
$strKeyword = $_POST["NameWard"];
}
?>
<?php
$conn = oci_connect('admin', 'admin', '192.168.99.250/hy' ,'UTF8');
// mysql_connect("localhost","root","root") or die(mysql_error());
// mysql_select_db("mydatabase");
?>
<body bgcolor="#CCFF99">
<form action="show.php" method="post" name="form1" target="_blank">
List Ward
<select name="NameWard" id="NameWard" value="<?php echo $strKeyword;?>">
<option value=""><-- Please Select Ward --></option>
<?php
$sql = "SELECT * FROM places WHERE pt_place_type_code ='2'";
$stid = oci_parse($conn,$sql);
oci_execute($stid);
while ($row = oci_fetch_array($stid,OCI_BOTH))
{
?>
<option value="<?php echo $row["PLACECODE"];?>"><?php echo $row["HALFPLACE"];?></option>
<?php
}
?>
</select>
<input name="btnSubmit" type="submit" value="Submit">
</form>
</body>
</html>
<?php
// oci_free_statement($stid);
// oci_close($oconn);
?>
ไฟล์ show.php
........................
<head>
<link rel="shortcut icon" href="img/hh.png">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>รายชื่อผู้ป่วย</title>
</head>
<body>
<?php
$strKeyword = null;
if(isset($_POST["NameWard"]))
{
$strKeyword = $_POST["NameWard"];
}
?>
<?php
$objConnect = oci_connect('admin', 'admin', '192.168.99.250/hy' ,'UTF8');
$strSQL1 = "SELECT ROW_NUMBER() OVER(ORDER BY dateadmit DESC) AS ROWNO, T.an,T.flname,T.bed_no,T.dateadmit FROM ipdtrans T where T.pla_placecode = '$strKeyword' AND datedisch IS NULL AND bed_no IS NOT NULL";
$objParse = oci_parse ($objConnect, $strSQL1);
oci_execute ($objParse,OCI_DEFAULT);
$Num_Rows = oci_fetch_all($objParse, $Result);
$Per_Page = 5; // Per Page
if(!isset($_GET["Page"]))
{
$Page=1;
}
else
{
$Page = $_GET["Page"];
}
$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;
}
$Page_End = $Per_Page * $Page;
IF ($Page_End > $Num_Rows)
{
$Page_End = $Num_Rows;
}
$Row_End = $Per_Page * $Page;
if($Row_End > $Num_Rows)
{
$Row_End = $Num_Rows;
}
?>
Ward : <?php echo $_POST['NameWard']; ?>
<form name="NameWard" method="post" action="<?php echo $_SERVER['SCRIPT_NAME'];?>">
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">AN </div></th>
<th width="98"> <div align="center">Name </div></th>
<th width="198"> <div align="center">เตียง </div></th>
<th width="97"> <div align="center">วันที่ Admit </div></th>
</tr>
<?php
$strSQL2 = "SELECT C.* FROM ($strSQL1) C WHERE C.ROWNO > $Page_Start AND C.ROWNO <= $Row_End";
$objParse = oci_parse($objConnect, $strSQL2);
oci_execute ($objParse,OCI_DEFAULT);
while($objResult = oci_fetch_array($objParse,OCI_ASSOC))
{
?>
<tr>
<td><div align="center"><?php echo $objResult["AN"];?></div></td>
<td><?php echo $objResult["FLNAME"];?></td>
<td><?php echo $objResult["BED_NO"];?></td>
<td><div align="center"><?php echo $objResult["DATEADMIT"];?></div></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&NameWard=$strKeyword'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&NameWard=$strKeyword'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&NameWard=$strKeyword'>Next>></a> ";
}
oci_close($objConnect);
?>
</form>
</body>
</html>
|
|
|
|
|
Date :
2017-04-03 22:08:08 |
By :
dydy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ภาพแสดงผล ไฟล์ list.php และ show.php
|
|
|
|
|
Date :
2017-04-03 22:10:00 |
By :
dydy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำได้เเล้วค่ะ เเค่เปลี่ยน POST เป็น GET
|
|
|
|
|
Date :
2017-04-04 11:08:49 |
By :
dydy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2017-04-04 16:39:37 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|