|
|
|
ช่วยดูหน่อยคับ มานแสดงค่าซ้ำกันทั้งตารางเลย ผมทำการเก็บข้อมูลลง Database MySQL ข้อมูลสามารถใส่ลงได้ |
|
|
|
|
|
|
|
ผมทำการเก็บข้อมูลลง Database MySQL
ข้อมูลสามารถใส่ลงได้อย่างปกติ
แต่เวลาผม list มาดูโดยเขียนโค้ดแสดงแบบนี้
<?php include('config_admin.php');?>
<?php require_once('../Connections/connresort.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_rsStore = 10;
$pageNum_rsStore = 0;
if (isset($_GET['pageNum_rsStore'])) {
$pageNum_rsStore = $_GET['pageNum_rsStore'];
}
$startRow_rsStore = $pageNum_rsStore * $maxRows_rsStore;
mysql_select_db($database_connresort, $connresort);
$query_rsStore = "SELECT roomtype.room_ID, store.code_ID, store.brand, store.description, store.status FROM store, roomtype WHERE store.room_ID = roomtype.room_ID";
$query_limit_rsStore = sprintf("%s LIMIT %d, %d", $query_rsStore, $startRow_rsStore, $maxRows_rsStore);
$rsStore = mysql_query($query_limit_rsStore, $connresort) or die(mysql_error());
$row_rsStore = mysql_fetch_assoc($rsStore);
if (isset($_GET['totalRows_rsStore'])) {
$totalRows_rsStore = $_GET['totalRows_rsStore'];
} else {
$all_rsStore = mysql_query($query_rsStore);
$totalRows_rsStore = mysql_num_rows($all_rsStore);
}
$totalPages_rsStore = ceil($totalRows_rsStore/$maxRows_rsStore)-1;
$queryString_rsStore = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsStore") == false &&
stristr($param, "totalRows_rsStore") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsStore = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rsStore = sprintf("&totalRows_rsStore=%d%s", $totalRows_rsStore, $queryString_rsStore);
$queryString_rsStore = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsStore") == false &&
stristr($param, "totalRows_rsStore") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsStore = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rsStore = sprintf("&totalRows_rsStore=%d%s", $totalRows_rsStore, $queryString_rsStore);
?>
<style type="text/css">
<!--
.style2 {font-weight: bold}
.style3 {font-size: 12px; font-weight: bold; }
.style7 {font-size: 12px; font-weight: bold; color: #9900FF; }
-->
</style>
<div align="center">
<p class="style2"><font color="#660000"><strong>ÃÒ¡Òê¹Ô´¤ÃØÀѳ±ìµèÒ§æ<br>
</strong></font></p>
<p align="left"><span class="style7">ÃÒ¡Òê¹Ô´Ëéͧ»¯ÔºÑµÔ¡Òà ¢³Ð¹ÕéÁÕ <?php echo $totalRows_rsStore ?> Ëéͧ áÊ´§Ë¹éÒÅÐ 10 Ëéͧ </span></p>
<table width="80%" border="0" align="center">
<tr>
<td width="25%"><?php if ($pageNum_rsStore > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rsStore=%d%s", $currentPage, max(0, $pageNum_rsrsStore - 1), $queryString_rsrsStore); ?>">Previous</a>
<?php } // Show if not first page ?> </td>
<td width="50%"><div align="center"><strong><a href="add_store.php">à¾ÔèÁª¹Ô´¢Í§¤ÃØÀѳ±ì</a></strong></div></td>
<td width="25%"><div align="right">
<?php if ($pageNum_rsStore < $totalPages_rsStore) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rsStore=%d%s", $currentPage, min($totalPages_rsStore, $pageNum_rsStore + 1), $queryString_rsStore); ?>">Next</a>
<?php } // Show if not last page ?> </div></td>
</tr>
</table>
<?php if ($totalRows_rsStore > 0) { // Show if recordset not empty ?>
<table width="80%" border="1" align="center">
<tr>
<td width="17%"><div align="center"><span class="style3">ËÁÒÂàÅ¢Ëéͧ</span></div></td>
<td width="17%"><div align="center"><span class="style3">ËÁÒÂàÅ¢¤ÃØÀѳ±ì</span></div></td>
<td width="14%"><div align="center"><span class="style3">ª×èͤÃØÀѳ±ì</span></div></td>
<td width="21%"><div align="center"><span class="style3">ÃÒÂÅÐàÍÕ´</span></div></td>
<td width="8%"><div align="center"><span class="style3">ʶҹÐ</span></div></td>
<td colspan="2"><div align="center"><span class="style3">»ÃѺ»Ãا</span></div></td>
</tr>
<?php do { ?>
<tr>
<td valign="top"><div align="center"><?php echo $row_rsStore['room_ID']; ?>
</div>
<div align="center"></div> <div align="center"></div> <div align="center"></div></td>
<td valign="top"><div align="center"><?php echo $row_rsStore['code_ID']; ?>
</div>
<div align="center"></div></td>
<td valign="top"><div align="center"><?php echo $row_rsStore['brand']; ?>
</div>
<div align="center"></div></td>
<td valign="top"><div align="center"><?php echo $row_rsStore['description'];
if ($row_rsStore['status'] == 1) { ?>
</div>
<div align="center"></div>
<td valign="top"><?php echo "´Õ";
} elseif ($row_rsStore['status'] == 2) { ?>
<div align="center"></div>
<div align="center"></div>
<td width="5%" valign="top"><?php echo "àÊÕÂ";
} elseif ($row_rsStore['status'] == 3) { ?>
<div align="center"></div>
<td width="5%" valign="top"><?php echo "Ê觫èÍÁ";
} elseif ($row_rsStore['status'] == 4) { ?>
<div align="center"></div>
<td width="5%" valign="top"><?php echo "¨Ó˹èÒ·Ôé§";
} ?>
<div align="center"></div></td>
<td width="5%"><div align="center"><a href="edit_store.php?store_ID=<?php echo $row_rsStore['store_ID']; ?>">á¡éä¢</a></div></td>
<td width="3%"><div align="center"><a href=# onClick="del('del_store.php?store_ID=<?php echo $row_rsStore['store_ID']; ?>&do=del&table=store')">ź</a></div></td>
</tr>
<?php } while ($row_rsStrore = mysql_fetch_assoc($rsStore)); ?>
</table>
<?php } // Show if recordset not empty ?>
<br>
<hr>
<p> </p>
<div align="center"><strong>Copyright by IT 6.22</strong></div>
<?php
mysql_free_result($rsStore);
?>
พอใส่ค่าไปใหม่ที่ไรมานก็จะแสดงค่าของเรคอรค์ใหม่ตลอดทั้งตารางเลย
ทิ้งที่ในฐานข้อมูลไม่ได้มีข้อมูลซำกันเลย
ข้อมูลในฐานข้อมูลถูกต้องตามที่ใส่ลงไปทุกอย่าง
ช่วยดูหน่อยคับว่าผมเขียนผิดตรงไหน
Tag : - - - -
|
|
|
|
|
|
Date :
5 มี.ค. 2549 22:50:28 |
By :
undertaker |
View :
51259 |
Reply :
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|