 |
|
จะถามเรื่องของการ เซิส ข้อมูล มันติดปัญหาตรงที่มันค้างค้าเดิมเวลา เซิสข้อมูล ถ้ากะรทำกับข้อมูลที่ค้าเจอแล้ว มันยังไม่เป็นค่าว่าง ต้องแก้ยังไงคับ
เช่นที่ ผมทำคือ ตอนแรก เปิดมาหน้านี้จะดึง ข้อมูลที่ select มา แล้ว เราทำการค้นหา เซิส ปุ๊ป จะขึ้นในสิ่งที่เราหา แล้วก็กระทำจนลบ แถวที่ เซิสขึ้นมาแล้ว เรียบร้อย แต่ สั้งให้ reload ยังไม่มีข้มูล แสดงว่า มันค้างค่าเดิม แน่ เลย แก้ยังไงดี คับ
Code (PHP)
<?
include("config.php");
$txtKeyword=$_POST["txtKeyword"] ;
$strSQL = "SELECT * FROM alert where (nisit_id_card LIKE '%$txtKeyword%'
OR alert_name LIKE '%$txtKeyword%'
OR alert_sname LIKE '%$txtKeyword%'
)";
$objQuery = mysql_db_query($dbname,$strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 20; // 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;
}
$strSQL .=" order by alert_id DESC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_db_query($dbname,$strSQL);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License
Title : Lotus Flower
Version : 1.0
Released : 20080501
Description: A two-column, fixed-width and lightweight template ideal for 1024x768 resolutions. Suitable for blogs and small websites.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>กยศ มหาวิทยาลัยเกษตรศาสตร์</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$('a[id^="no"]').fancybox({
'width' : '60%',
'height' : '100%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
onClosed : function() {
parent.location.reload(true);
}
});
$('a[id^="search"]').fancybox({
'width' : '60%',
'height' : '100%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
onClosed : function() {
parent.location.reload(true);
}
});
/*
onStart : function() {
return window.confirm('Continue?');
},
onCancel : function() {
alert('Canceled!');
},
onComplete : function() {
alert('Completed!');
},
onCleanup : function() {
return window.confirm('Close?');
},
onClosed : function() {
alert('Closed!');
}
*/
});
</script>
</head>
<body>
<form id="loginForm" name="loginForm" method="post" action="alert.php" >
<table width="660" border="1">
<tr>
<th width="659"><strong>กรุณาใส่คีย์เวิร์ดที่ต้องการค้นหา</strong>
<input name="txtKeyword" type="text" id="txtKeyword" size="30" v>
<input type="submit" name="search" id="search" value="ค้นหา" ></th>
</tr>
</table>
</form>
<table width="640" border="0">
<tr>
<td width="133"bgcolor='#339933' ><div align="center"><strong><font color='WHITE'>รหัสบัตรประชาชน</font></strong></div></td>
<td width="180"bgcolor='#339933' ><div align="center"><strong><font color='WHITE'>ชื่อ-นามสุกล</font></strong></div>
</td>
<td width="95"bgcolor='#339933' ><div align="center"><strong><font color='WHITE'>สถานะ</font></strong></div></td>
<td width="130"bgcolor='#339933' ><div align="center"><strong><font color='WHITE'>ตรวจเอกสาร</font></strong></div></td>
<td width="80"bgcolor='#339933' ><div align="center"><strong><font color='WHITE'>ข้อมูลนิสิต</font></strong></div></td>
</tr>
<?
//echo $txtKeyword=$_GET["txtKeyword"] ;
//echo $strSQL;
$i=0;
while($objResult = mysql_fetch_array($objQuery))
{
$i++;
?>
<tr>
<td><?=$objResult["nisit_id_card"]; ?></td>
<td><?=$objResult["alert_name"]." ".$objResult["alert_sname"]; ?></td>
<td><div align="center"><? if($objResult["alert_status"]== "1") {echo "รอพิจารณา";}
if($objResult["alert_status"]== "2") {echo "ผ่านการตรวจแล้ว";}
if($objResult["alert_status"]== "3") {echo "ยังขาดเอกสาร";}?></div></td>
<td><center>
<? if($objResult["alert_status"]== "1" ||$objResult["alert_status"]== "3") { ?>
<a id="no<?=$i;?>" class="various iframe" href="incomplete1.php?nisit_id_card=<?=$objResult["nisit_id_card"];?>"><input type="button" name="chek" id="chek" value="ตรวจเอกสาร"/></a>
<? }else { echo "ตรวจแล้ว" ;} ?>
</center></td>
<td>
<a id="see<?=$i;?>" class="various iframe" target="_blank" href="show_student.php?nisit_id_card=<?=$objResult["nisit_id_card"];?>">แสดง</a>
</td>
<?php /*?> <td align="center"><a id="delete<?=$i;?>" class="various iframe" href="#">ประวัติ</a></td><?php */?>
</tr> <? } ?>
</table>
<?php /*?>Total <?= $Num_Rows;?> <?php */?>
จำนวน:
<?=$Num_Pages;?> หน้า :
<?
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();
?>
Tag : PHP, MySQL
|
|
 |
 |
 |
 |
Date :
2014-11-14 16:16:36 |
By :
komza |
View :
774 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |