|
|
|
ด่วนมาก รบกวนช่วยดูโค้ดให้หน่อยค่ะ ข้อมูลไม่ขึ้นค่ะ แต่ไม่เออเรอ |
|
|
|
|
|
|
|
Code (PHP)
<?php
include "connect_odbc.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Flat Pairin Online</title>
<style type="text/css">
<!--
.style24 {
color: #666666;
font-weight: bold;
}
-->
</style>
<STYLE>
A:link {
COLOR: #FF9933; TEXT-DECORATION: none
}
A:active {
COLOR: #0066FF; TEXT-DECORATION: none
}
A:visited {
COLOR: #FF9933; TEXT-DECORATION: none
}
A:hover {
COLOR: #0066FF; TEXT-DECORATION: none
}
.style28 {font-size: 13px}
.style30 {
font-size: 13px;
font-weight: bold;
color: #666666;
}
.style31 {color: #666666; font-size: 13px;}
.style32 {
color: #FF9933;
font-weight: bold;
}
.style33 {
color: #FF9933;
font-size: 13px;
}
.style37 {color: #FF9933; font-size: 13px; font-weight: bold; }
.style34 {color: #FF6633; font-size: 13px; }
</STYLE>
<SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</SCRIPT>
</head>
<body background="img/bg.gif" leftmargin="0" topmargin="0"
onload="MM_preloadImages('img/menu1.gif','img/menu2.gif','img/menu3.gif','img/menu4.gif','img/menu5.gif','img/menu_m1.gif','img/d1_2.gif','img/d2_2.gif','img/d3_2.gif')"
marginheight="0" marginwidth="0">
<table width="991" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td height="30" colspan="8" valign="top" align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="804" align="left" class="style30"> <img src="img/user.gif" width="30" height="32" border="0"/> สวัสดีคุณ <span class="style34"><?php echo $_SESSION[sess_username]; ?></span> </td>
<td width="186" align="left" ><a href="logout.php"><img src="img/logout.gif" width="100" height="25" border="0"/></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="283" colspan="8"><img src="img/branner.jpg" width="991" height="283" border="0" /></td>
</tr>
<tr>
<td width="49" height="42"><img src="img/menu.jpg" width="49" height="42" border="0" /></td>
<td width="92"><A onMouseOver="MM_swapImage('Image1','','img/menu1.gif',1)" onmouseout=MM_swapImgRestore() href="home2.php"><img src="img/menu1_2.gif" width="92" height="42" border="0" name=Image1 /></A></td>
<td width="85"><A onMouseOver="MM_swapImage('Image2','','img/menu2.gif',1)" onmouseout=MM_swapImgRestore() href="member.php"><img src="img/menu2_2.gif" width="85" height="42" border="0" name=Image2 /></A></td>
<td width="115"><A onMouseOver="MM_swapImage('Image3','','img/menu3.gif',1)" onmouseout=MM_swapImgRestore() href="data.php"><img src="img/menu3.gif" width="115" height="42" border="0" name=Image3 /></A></td>
<td width="138"><A onMouseOver="MM_swapImage('Image4','','img/menu4.gif',1)" onmouseout=MM_swapImgRestore() href="roommag.php"><img src="img/menu4_2.gif" width="138" height="42" border="0" name=Image4 /></A></td>
<td width="90"><A onMouseOver="MM_swapImage('Image5','','img/menu5.gif',1)" onmouseout=MM_swapImgRestore() href="contact.php"><img src="img/menu5_2.gif" width="90" height="42" border="0" name=Image5 /></A></td>
<td width="109"><A onMouseOver="MM_swapImage('Image6','','img/menu_m1.gif',1)" onmouseout=MM_swapImgRestore() href="reserve.php"><img src="img/menu_m1_2.gif" width="109" height="42" border="0" name=Image6 /></A></td>
<td width="313"><img src="img/menu6_2.gif" border="0" /></td>
</tr>
<tr>
<td height="25" colspan="8"><img src="img/c1.jpg" width="991" height="25" border="0"></td>
</tr>
<tr>
<td height="36" colspan="8"><table width="981" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="19" height="372" background="img/l1.jpg"> </td>
<td width="9" valign="top"> </td>
<td width="201" valign="top"><img src="img/mmm.gif"/><br />
<A onMouseOver="MM_swapImage('Image7','','img/d1_2.gif',1)" onmouseout=MM_swapImgRestore() href="data.php"><img src="img/d1.gif" width="198" height="70" border="0" name=Image7 /></A><br />
<img src="img/mmm.gif"/><br />
<A onMouseOver="MM_swapImage('Image8','','img/d2_2.gif',1)" onmouseout=MM_swapImgRestore() href="data2.php"><img src="img/d2.gif" width="198" height="70" border="0" name=Image8 /></A><br />
<img src="img/mmm.gif"/><br />
<A onMouseOver="MM_swapImage('Image9','','img/d3_2.gif',1)" onmouseout=MM_swapImgRestore() href="data3.php"><img src="img/d3.gif" width="198" height="70" border="0" name=Image9 /></A><br />
<img src="img/mmm.gif"/><br />
<img src="img/mmm.gif"/><br />
<br />
<br />
<br /></td>
<td width="29"> </td>
<td width="686" valign="top"><table width="679" height="140" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><img src="img/bac1.jpg" width="678" height="27" border="0"/></td>
</tr>
<tr>
<td width="19" background="img/bac2_1.gif"> </td>
<td width="642" align="center">
<table width="641">
<?
include "connect_odbc.php";
//include "function.php";
//$objConnect = oci_connect("pairin","flat","room");
$strSQL = "SELECT * FROM room ";
#$strSQL = "SELECT * FROM room ORDER BY room_id ASC";
$stmt = oci_parse ($conn, $strSQL);
oci_execute ($stmt, OCI_DEFAULT);
$Num_Rows = oci_fetch_all($stmt, $Result);
$Per_Page = 2; // แสดงต่อหน้า
$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;
}
$Page_End = $Per_Page * $Page;
IF ($Page_End > $Num_Rows)
{
$Page_End = $Num_Rows;
}
?>
<tr bgcolor="#CCCCCC">
<td width="60" class="style30">ชั้น</td>
<td width="100" class="style30">ห้อง</td>
<td width="80" class="style30">สถานะ</td>
</tr>
<?
for($i=$Page_Start;$i<$Page_End;$i++){
$room_floor = $row[1];
$room_id = $row[0];
$room_sit = $row[4];
if ($room_sit ==1) {
$sh = "bgcolor=\"red\"";
} else {
$sh = "bgcolor=\"green\"";
}
?>
<tr bgcolor="#e0eff8">
<td><div align="center"><?=$room_floor?></div></td>
<td><?=$room_id?></td>
<td <?=$sh?>><?=$room_sit?></td>
</tr>
<?
}
?>
</table>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
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> ";
}
oci_close($conn);
?>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /> </td>
<td width="19" background="img/bac2_2.gif"> </td>
</tr>
<tr>
<td colspan="3"><img src="img/bac3.jpg" width="678" height="27" border="0" /></td>
</tr>
</table></td>
<td width="22" background="img/r1.jpg"> </td>
</tr>
</table>
<img src="img/c2.jpg" width="991" height="24" border="0" /></td>
</tr>
<tr>
<td colspan="8"><img src="img/button3.jpg" width="991" height="60" border="0"></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>
?>
รูปภาพประกอบ
รูปภาพ
Tag : - - - -
|
|
|
|
|
|
Date :
2009-03-24 21:32:47 |
By :
มึนจัง |
View :
947 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$strSQL = "SELECT * FROM room ";
#$strSQL = "SELECT * FROM room ORDER BY room_id ASC";
$stmt = oci_parse ($conn, $strSQL);
//oci_execute ($stmt, OCI_DEFAULT);
$Result = oci_execute ($stmt, OCI_DEFAULT); // <--- ตรงนี้ครับลองดูครับ
$Num_Rows = oci_fetch_all($stmt, $Result);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>
ตามมาตอบให้ครับ
|
|
|
|
|
Date :
2009-03-24 21:55:04 |
By :
dr.website |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อ้าว Database Oracle เหรอครับ
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com PHP & Oracle Tutorial</title>
</head>
<body>
<?
$objConnect = oci_connect("myuser","mypassword","TCDB");
$strSQL = "SELECT * FROM CUSTOMER ORDER BY CUSTOMERID ASC";
$objParse = oci_parse ($objConnect, $strSQL);
oci_execute ($objParse,OCI_DEFAULT);
$Num_Rows = oci_fetch_all($objParse, $Result);
$Per_Page = 2; // Per Page
$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;
}
$Page_End = $Per_Page * $Page;
IF ($Page_End > $Num_Rows)
{
$Page_End = $Num_Rows;
}
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID </div></th>
<th width="98"> <div align="center">Name </div></th>
<th width="198"> <div align="center">Email </div></th>
<th width="97"> <div align="center">CountryCode </div></th>
<th width="59"> <div align="center">Budget </div></th>
<th width="71"> <div align="center">Used </div></th>
</tr>
<?
for($i=$Page_Start;$i<$Page_End;$i++)
{
?>
<tr>
<td><div align="center"><?=$Result["CUSTOMERID"][$i];?></div></td>
<td><?=$Result["NAME"][$i];?></td>
<td><?=$Result["EMAIL"][$i];?></td>
<td><div align="center"><?=$Result["COUNTRYCODE"][$i];?></div></td>
<td align="right"><?=$Result["BUDGET"][$i];?></td>
<td align="right"><?=$Result["USED"][$i];?></td>
</tr>
<?
}
?>
</table>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
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> ";
}
oci_close($objConnect);
?>
</body>
</html>
Ref : PHP Oracle List Record Paging
|
|
|
|
|
Date :
2009-03-24 22:00:53 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณค่ะพี่ๆๆ แต่หนูงงค่ะพี่ ช่วยอธิบายหน่อยนะนะค่ะ
|
|
|
|
|
Date :
2009-03-24 22:28:38 |
By :
มึนจัง |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|