|
|
|
อยากสอบถามเรื่อง เงื่อนไขในการแสดงผลครับ พิมพ์ช่องใด ข้อมูลช่องนั้นออกมา (มีรูปจร้า) |
|
|
|
|
|
|
|
ช่วยทีคร๊าบบบ อันนี้ โค้ดแบบเต็มๆเลยคร๊าบบ
Code (PHP)
<?
include("config.inc.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" dir="ltr" lang="en-US" xml:lang="en">
<head>
<!--
Created by Artisteer v3.1.0.48375
Base template (without user's data) checked by http://validator.w3.org : "This page is valid XHTML 1.0 Transitional"
-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Cabling Data Center Management System</title>
<link rel="stylesheet" type="text/css" href="pagination.css" /><!--ตัวจัด CSS ปุ่มแบ่งหน้า-->
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]-->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="script.js"></script>
<style type="text/css">
.art-post .layout-item-0 { padding-right: 10px;padding-left: 10px; }
.ie7 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
.ie6 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
</style>
<style type="text/css">
@media print
{
#non-printable { display: none; }
#printable { display: block; }
}
body,td,th {
font-family: "Courier New";
font-size: 14px;
}
#art-page-background-middle-texture #art-main .art-box.art-sheet .art-box-body.art-sheet-body .art-layout-wrapper .art-content-layout .art-content-layout-row .art-layout-cell.art-content .art-box.art-post .art-box-body.art-post-body .art-post-inner.art-article .art-postcontent .art-content-layout .art-content-layout-row .art-layout-cell.layout-item-0 table {
font-weight: bold;
}
</style>
</head>
<body>
<div id="art-page-background-middle-texture">
<div id="art-main">
<div class="cleared reset-box"></div>
<div class="art-header">
<div class="art-header-position">
<div class="art-header-wrapper">
<div class="cleared reset-box"></div>
<div class="art-header-inner">
<div class="art-headerobject"></div>
<div class="art-logo">
<div id="non-printable">
<h1 class="art-logo-name"><a href="index.php">Cabling Data Center Management System</a></h1>
<h2 class="art-logo-text">ระบบจัดการสาย Cabling ในศูนย์ Data Center</h2>
</div></div>
</div>
</div>
</div>
<div class="art-bar art-nav">
<div class="art-nav-outer">
<div class="art-nav-wrapper">
<div class="art-nav-inner">
<div id="non-printable">
<ul class="art-hmenu">
<li>
<a href="#" class="active">Link</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="cleared reset-box"></div>
</div>
<div class="cleared reset-box"></div>
<div class="art-box art-sheet">
<div class="art-box-body art-sheet-body">
<div class="art-layout-wrapper">
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell art-content">
<div class="art-box art-post">
<div class="art-box-body art-post-body">
<div class="art-post-inner art-article">
<div class="art-postmetadataheader">
<h2 class="art-postheader">
<div id="non-printable">
<form name="searchform" method="post" action="">
<table width="1300" border="1">
<tr>
<th>Room
<input name="room_a" type="text" value="<?=$_REQUEST["room_a"];?>" size="3">
Row
<input name="row_a" type="text" value="<?=$_REQUEST["row_a"];?>" size="3">
Rock
<input name="rack_a" type="text" value="<?=$_REQUEST["rack_a"];?>" size="3">
A-Z
<input name="storage_a" type="text" value="<?=$_REQUEST["storage_a"];?>" size="30">
<select name="search_a">
<option value="" <? if($_REQUEST[""]==""){ ?>selected<? }?>>Select</option>
<option value="sourcelocation_a" <? if($_REQUEST["search_a"]=="sourcelocation_a"){ ?>selected<? }?>>Source Location</option>
<option value="sourceport_a" <? if($_REQUEST["search_a"]=="sourceport_a"){ ?>selected<? }?>>Source Port</option>
<option value="interface_a" <? if($_REQUEST["search_a"]=="interface_a"){ ?>selected<? }?>>Interface</option>
<option value="protocol_a" <? if($_REQUEST["search_a"]=="protocol_a"){ ?>selected<? }?>>Protocol</option>
<option value="product_a" <? if($_REQUEST["search_a"]=="product_a"){ ?>selected<? }?>>Product</option>
<option value="devicename_a" <? if($_REQUEST["search_a"]=="devicename_a"){ ?>selected<? }?>>Device Name</option>
<option value="ipaddress_a" <? if($_REQUEST["search_a"]=="ipaddress_a"){ ?>selected<? }?>>IP Address</option>
<option value="destinationport_a" <? if($_REQUEST["search_a"]=="destinationport_a"){ ?>selected<? }?>>Destination Port</option>
<option value="destinationlocation_a" <? if($_REQUEST["search_a"]=="destinationlocation_a"){ ?>selected<? }?>>Destination Location</option>
<option value="remark_a" <? if($_REQUEST["search_a"]=="remark_a"){ ?>selected<? }?>>Remark</option>
</select>
<input type="text" name="keyword_a" value="<?=$_REQUEST["keyword_a"];?>" placeholder="Keyword"/>
<input type="submit" name="submit" value="Search">
</th>
</tr>
</table>
</form>
</div>
</h2>
</div>
<div class="art-postcontent">
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell layout-item-0" style="width: 100%;">
<p style="text-align: center;">
<!-- แสดงข้อมูลที่รับมา --></p>
<div id="non-printable">
<a href="logout.php"><img src="image/1378568937_logout.png" alt="ออกจากระบบ" width="50" height="50" align="right" /></a>
<p style="text-align: center;"><a href="phpMySQLAddForm.php" target="_blank"><a href="phpMySQLAddForm.php" target="_blank"><img src="image/1378568398_add1-.png" alt="เพิ่มข้อมูลใหม่" width="40" height="40" align="left" /></a>
<p style="text-align: center;"><img src="image/1378567009_printer.png" alt="พิพม์" width="40" height="40" align="left" onclick="window.print()"/></span></p><p style="text-align: center;"><br />
</div>
<p style="text-align: center;">
Room : <strong><? echo $room_a?><? echo $room_b?></strong>
Row : <strong><? echo $row_a?></strong><strong><? echo $row_b?></strong>
Rack : <strong><? echo $rack_a?></strong><strong><? echo $rack_b?></strong>
Storage : <strong><? echo $storage_a?></strong><strong><? echo $storage_b?></strong>
Search : <strong><? echo $search_a?><? echo $search_b?></strong>
Keyword : <strong><? echo $keyword_a?></strong><strong><? echo $keyword_b?></strong>
</p>
<!-- จบ แสดงข้อมูลที่รับมา -->
<?
if($_POST || $_GET){
require_once('pagination.inc.php'); //คลาสแบ่งหน้า
$row_per_page = 7; //จำนวนบรรทัดต่อหน้า
$pagination = new CompletePagination($row_per_page);
//$_REQUEST เป็นตัวที่สามารถรับทั้งค่า $_POST และ $_GET ได้
if ($_REQUEST["room_a"]) {
$where[] = " room_a LIKE '%".$_REQUEST["room_a"]."%' ";
}
if ($_REQUEST["row_a"]) {
$where[] = " row_a LIKE '%".$_REQUEST["row_a"]."%' ";
}
if ($_REQUEST["rack_a"]) {
$where[] = " rack_a LIKE '%".$_REQUEST["rack_a"]."%' ";
}
if ($_REQUEST["storage_a"]) {
$where[] = " storage_a LIKE '%".$_REQUEST["storage_a"]."%' ";
}
if ($_REQUEST["keyword_a"]) {
$where[] = " ".$_REQUEST["search_a"]." LIKE '%".$_REQUEST["keyword_a"]."%' ";
}
if ($_REQUEST["room_a"] == '' && $_REQUEST["row_a"] == '' && $_REQUEST["rack_a"] == '' && $_REQUEST["storage_a"] == '' && $_REQUEST["keyword_a"] == '')
// -- ค้นหาปลายทางนะครับ -- //
if ($_REQUEST["room_b"]) {
$where[] = " room_b LIKE '%".$_REQUEST["room_b"]."%' ";
}
if ($_REQUEST["row_b"]) {
$where[] = " row_b LIKE '%".$_REQUEST["row_b"]."%' ";
}
if ($_REQUEST["rack_b"]) {
$where[] = " rack_b LIKE '%".$_REQUEST["rack_b"]."%' ";
}
if ($_REQUEST["storage_b"]) {
$where[] = " storage_b LIKE '%".$_REQUEST["storage_b"]."%' ";
}
if ($_REQUEST["keyword_b"]) {
$where[] = " ".$_REQUEST["search_b"]." LIKE '%".$_REQUEST["keyword_b"]."%' ";
}
if ($_REQUEST["room_b"] == '' && $_REQUEST["row_b"] == '' && $_REQUEST["rack_b"] == '' && $_REQUEST["storage_b"] == '' && $_REQUEST["keyword_b"] == '')
{
//หากไม่มีการกรอกข้อมูล
$query_count = "SELECT COUNT(*) AS total_all FROM sourcedestination "; //นับจำนวนที่ต้องการเพื่อทำการหารแบ่งหน้า
$result_count = mysql_query($query_count);
$record_count = mysql_fetch_array($result_count);
$total_rec = $record_count['total_all'];
$sql = "SELECT * FROM sourcedestination "; //เลือกข้อมูลที่ต้องการ
$sql .= " LIMIT ".$pagination->getLimit() . ", " . $row_per_page;
}
else //ถ้าหากฟอร์มมีการกรอกมาอย่างหน้อย 1 ช่อง
{
$imp = implode(" AND ", $where); //ใช้ AND เชื่อมต่อ Array ข้อมูลที่ค้นหา
$str_count = "SELECT COUNT(*) AS total_all FROM sourcedestination WHERE "; //นับจำนวนที่ต้องการเพื่อทำการหารแบ่งหน้า
$query_count .= $str_count.$imp;
$result_count = mysql_query($query_count);
$record_count = mysql_fetch_array($result_count);
$total_rec = $record_count['total_all'];
$str = "SELECT * FROM sourcedestination WHERE "; //เลือกข้อมูลที่ต้องการ
$sql .= $str.$imp;
$sql .= " LIMIT ".$pagination->getLimit() . ", " . $row_per_page;
$result = mysql_query($sql);
}
$objQuery = mysql_query($sql) or die ("Error Query [".$sql."]");
$pagination->total_rows = $total_rec; //จำนวนทั้งหมดที่ค้นหา
$pagination->show_ellipsis = 10; //จำนวนที่จะเป็นระยะหากมีมากไปจะทำการย่อเป็นช่วงๆๆให้
$pagination->show_dropdown = false; //ถ้าจะให้แสดงดรอปดาวน์ให้เปลี่ยนเป็น true
$pagination->show_total_records = false; //แสดงจำนวนหมายเลขหน้า
$pagination->show_page_no = false; //แสดงหมายเลขหน้า
$pagination_number = $pagination->showCompletePagination(); //สร้างตัวแปรเพื่อแสดงปุ่มแบ่งหน้า
?>
</p>
<table width="1295" border="1" align="center">
<tr bgcolor="#CCCCCC">
<th colspan="1" align="center" valign="middle">#</th>
<th colspan="4" align="center" valign="middle"><strong>SOURCE</strong></th>
<th colspan="6" align="center" valign="middle"><strong>DESTINATION</strong></th>
</tr>
<tr align="center" bgcolor="#999999">
<td width="90" align="center" valign="middle" bgcolor="#999999" ><strong>Edit|Delete</strong></td>
<td width="173" height="26" align="center" valign="middle" bgcolor="#999999"><strong>Source Location</strong></td>
<td width="121" align="center" valign="middle" bgcolor="#999999"><strong>Source Port</strong></td>
<td width="74" align="center" valign="middle" bgcolor="#999999"><strong>Interface</strong></td>
<td width="66" align="center" valign="middle" bgcolor="#999999"><strong>Protocol</strong></td>
<td width="131" align="center" valign="middle" bgcolor="#999999" ><strong> Product</strong></td>
<td width="90" align="center" valign="middle" bgcolor="#999999" ><strong>Device Name</strong></td>
<td width="96" align="center" valign="middle" bgcolor="#999999" ><strong>IP Address</strong></td>
<td width="145" align="center" valign="middle" bgcolor="#999999" ><strong>Destination Port</strong></td>
<td width="189" align="center" valign="middle" bgcolor="#999999" ><strong>Destination Location</strong></td>
<td width="50" align="center" valign="middle" bgcolor="#999999" ><strong>Remark</strong></td>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery)) {
if($bg == "#99FF66"){ $bg = "#EEEEEE"; }
else { $bg = "#99FF66"; }
?>
<tr bgcolor="<?=$bg?>" align="center">
<td align="center" valign="middle">
<a href="phpMySQLEditRecordForm.php?id=<?=$objResult["id"];?>"><img src="image/1378293707_cog_edit.png" width="30" height="30" /></a>
<a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='phpMySQLDeleteRecord.php?id=<?=$objResult["id"];?>';}"><img src="image/1378571326_button_cancel.png" width="30" height="30" /></a>
</td>
<td align="center" valign="middle">
<?=$objResult["sourcelocation_a"];?><?=$objResult["sourcelocation_b"];?>
</td>
<td align="center" valign="middle"><?=$objResult["sourceport"];?><?=$objResult["sourceport"];?></td>
<td align="center" valign="middle"><?=$objResult["interface"];?><?=$objResult["interface"];?></td>
<td align="center" valign="middle"><?=$objResult["protocol"];?><?=$objResult["protocol"];?></td>
<td align="center" valign="middle"><?=$objResult["product"];?><?=$objResult["product"];?></td>
<td align="center" valign="middle"><?=$objResult["devicename"];?><?=$objResult["devicename"];?></td>
<td align="center" valign="middle"><?=$objResult["ipaddress"];?><?=$objResult["ipaddress"];?></td>
<td align="center" valign="middle"><?=$objResult["destinationport"];?><?=$objResult["destinationport"];?></td>
<td align="center" valign="middle"><?=$objResult["destinationlocation"];?><?=$objResult["destinationlocation"];?></td>
<td align="center" valign="middle"><?=$objResult["remark"];?><?=$objResult["remark"];?></td>
</tr>
<?
}
?>
</table>
<div id="non-printable">
<?=$pagination_number?><!--แสดงปุ่มแบ่งหน้า-->
</div>
<?
}
?>
</p>
<p></p>
</div>
</div>
</div>
</div>
<div class="cleared"></div>
</div>
<div class="cleared"></div>
</div>
</div>
<div class="cleared"></div>
</div>
</div>
</div>
</div>
<div class="cleared"></div>
<div class="art-footer">
<div class="art-footer-body">
<a href="#" class="art-rss-tag-icon" title="RSS"></a>
<div class="art-footer-text">
<div id="non-printable"><p>Cabling Data Center Management System</p>
<p>Copyright © 2013. All Rights Reserved. By lekjaeng</p></div>
</div>
<div class="cleared"></div>
</div>
</div>
<div class="cleared"></div>
</div>
</div>
</div>
</div>
</body>
</html>
|
|
|
|
|
Date :
2013-09-17 19:43:36 |
By :
ขอความช่วยเหลือ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|