Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > PHP > PHP Forum > PHP MSSQl ฟอร์มค้นหาข้อมูลแบบ list ไม่แสดงผลลัพธ์ ช่วยดูไห้หน่อยครับ



 

PHP MSSQl ฟอร์มค้นหาข้อมูลแบบ list ไม่แสดงผลลัพธ์ ช่วยดูไห้หน่อยครับ

 



Topic : 099525



โพสกระทู้ ( 34 )
บทความ ( 0 )



สถานะออฟไลน์




PHP MSSQl ฟอร์มค้นหาข้อมูลแบบ list ไม่แสดงผลลัพธ์

ตอนแรกผมโพสไปว่าดัดแปลงมาจากกระทู้ในเวบ ในช่อง search มันเป็น text ซึ่งสามารถแสดงผลลัพธ์ได้ครับ

แต่พอเปลี่ยนเป็นค้นหา List ผลปรากฏว่ามันค้นหา ไม่ออกเลยครับ พี่ๆๆช่วยดูไห้หน่อย

<html>
<head>
<title>................<<..>>.............</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874"></head>
<body>
<form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>&nbsp;</td>
</tr>
</table>
<table width="467" border="1" align="center">
<tr>
<th width="129" align="left"><p>รหัสบัตรประชาชน</p></th>
<th width="322" align="left"><input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>"></th>
</tr>
<tr>
<th align="left">เพศ</th>
<th align="left"><select name="txtKeyword2" id="txtKeyword2">
<option>- Select -</option>
<option value="<?=$_GET["ชาย"];?>">ชาย</option>
<option value="<?=$_GET["หญิง"];?>">หญิง</option>
</select></th>

</tr>
<tr>
<th align="left">ชื่อ</th>
<th align="left"><input name="txtKeyword3" type="text" id="txtKeyword3" value="<?=$_GET["txtKeyword3"];?>"></th>
</tr>
<tr>
<th align="left">เขต / อำเภอ</th>
<th align="left"><input name="txtKeyword4" type="text" id="txtKeyword4" value="<?=$_GET["txtKeyword4"];?>"></th>
</tr>
<tr>
<th align="left">การศึกษา</th>
<th align="left"><select name="txtKeyword5" id="txtKeyword5">
<option>- Select -</option>
<option value="<?=$_GET["ประถมศึกษา"];?>">ประถมศึกษา</option>
<option value="<?=$_GET["มัธยมศึกษา"];?>">มัธยมศึกษา</option>
<option value="<?=$_GET["อนุปริญญา"];?>">อนุปริญญา</option>
<option value="<?=$_GET["ปริญญาตรี"];?>">ปริญญาตรี</option>
<option value="<?=$_GET["ปริญญาโท"];?>">ปริญญาโท</option>
<option value="<?=$_GET["ปริญญาเอก"];?>">ปริญญาเอก</option>
</select></th>
</tr>
<tr>
<th align="left">อาชีพ</th>
<th align="left"><input name="txtKeyword6" type="text" id="txtKeyword6" value="<?=$_GET["txtKeyword6"];?>"></th>
</tr>
<tr>
<th align="left">รายได้ต่อเดือน</th>
<th align="left"><input name="txtKeyword7" type="text" id="txtKeyword7" value="<?=$_GET["txtKeyword7"];?>"></th>
</tr>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
<tr>
<th><input type="submit" value="Search"></th>
<th>&nbsp;</th>
</tr>
</table>
</form>
<?
include("../config.inc.php") ;
// Search By Name or Email
$strSQL = "SELECT * FROM Member WHERE (IDCard LIKE '%".$_GET["txtKeyword"]."%'
and Sex LIKE '%".$_GET["txtKeyword2"]."%'
and FName LIKE '%".$_GET["txtKeyword3"]."%'
and District LIKE '%".$_GET["txtKeyword4"]."%'
and Education LIKE '%".$_GET["txtKeyword5"]."%'
and Occuption LIKE '%".$_GET["txtKeyword6"]."%'
and Income LIKE '%".$_GET["txtKeyword7"]."%') ";
$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mssql_num_rows($objQuery);

$Per_Page = 10; // 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="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="1021" border="1" align="center">
<tr>
<th width="91"> <div align="center">บัตรประชาชน</div></th>
<th width="203"> <div align="center">ชื่อ</div></th>
<th width="131">เพศ</th>
<th width="218">เขต / อำเภอ</th>
<th width="182">การศึกษา</th>
<th width="156"> <div align="center">รายได้ต่อเดือน</div></th>
</tr>
<?
for($i=$Page_Start;$i<$Page_End;$i++)
{
?>
<tr>
<td><div align="center">
<?=mssql_result($objQuery,$i,"IDCard");?>
</div></td>
<td><?=mssql_result($objQuery,$i,"FName");?></td>
<td><?=mssql_result($objQuery,$i,"Sex");
?></td>
<td><?=mssql_result($objQuery,$i,"District");
?></td>
<td><?=mssql_result($objQuery,$i,"Education");

?></td>
<td><?=mssql_result($objQuery,$i,"Income");
?></td>
</tr>
<?
}
?>
</table>
<br>
Total
<?= $Num_Rows;?>
Record :
<?=$Num_Pages;?>
Page :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]'><< Back</a> ";
}

for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]'>Next>></a> ";
}

mssql_close($objConnect);

?></td>
</tr>
</table>
<br>
</body>
</html>

s



Tag : PHP, Ms SQL Server 2005







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-08-23 18:02:31 By : วันพีช View : 804 Reply : 1
 

 

No. 1



โพสกระทู้ ( 3,844 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์
Twitter Facebook

โค้ทคุณมันไม่ถูกครับ คุณส่ง get keyword คุณต้องเอาไป query เอาข้อมูลออก แล้วค่อยมาใส่ textbox






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-23 18:14:41 By : mangkunzo
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : PHP MSSQl ฟอร์มค้นหาข้อมูลแบบ list ไม่แสดงผลลัพธ์ ช่วยดูไห้หน่อยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่