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,027

HOME > PHP > PHP Forum > ต้องการค้นเป็นข้อมูลระหว่าง between แต่ลองไส่ code ไปแล้วไม่ออกเลยครับ พวกพี่ๆๆช่วยแนะนำหน่อยครับ



 

ต้องการค้นเป็นข้อมูลระหว่าง between แต่ลองไส่ code ไปแล้วไม่ออกเลยครับ พวกพี่ๆๆช่วยแนะนำหน่อยครับ

 



Topic : 100391



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



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




between

ผมสร้างหน้าค้นหาขึ้นมา โดย field สุดท้ายต้องการค้นเป็นข้อมูลระหว่าง between แต่ลองไส่ code ไปแล้วไม่ออกเลยครับ
พวกพี่ๆๆช่วยแนะนำหน่อยครับ



[font=Verdana]code search

Code
include("../config.inc.php") ; $strSQL = "SELECT * FROM Member WHERE (NumberCard LIKE '%".$_GET["txtKeyword"]."%' and IDCard LIKE '%".$_GET["txtKeyword2"]."%' and Sex LIKE '%".$_GET["txtKeyword3"]."%' and Age LIKE '%".$_GET["txtKeyword4"]."%' and District LIKE '%".$_GET["txtKeyword5"]."%' and Education LIKE '%".$_GET["txtKeyword6"]."%' and Occuption LIKE '%".$_GET["txtKeyword7"]."%' and Income LIKE '%".$_GET["txtKeyword8"]."%' and Income LIKE '%".$_GET["txtKeyword9"]."%')";[/font]




Tag : PHP, MySQL, Ms SQL Server 2005, Ms SQL Server 2008, Ms SQL Server 2012







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-09-12 17:21:31 By : วันพีช View : 623 Reply : 5
 

 

No. 1



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



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


ผมลองแก้

Code (PHP)
$objQuery = "SELECT * FROM Member WHERE 1";
if($_GET["txtKeyword"] != "" or $_GET["txtKeyword1"] != "" or $_GET["txtKeyword2"] != "" or $_GET["txtKeyword3"] != "" or $_GET["txtKeyword4"] != "" ){
	if($_GET["txtKeyword"] != "" or $_GET["txtKeyword1"] != ""){	
		$objQuery .= " and (Income between '".$_GET["txtKeyword"]."' and '".$_GET["txtKeyword1"]."') ";
	}
	if($_GET["txtKeyword2"] != ""){
		$objQuery .= " and IDCard LIKE '%".$_GET["txtKeyword2"]."%' ";
	}
	if($_GET["txtKeyword3"] != ""){
		$objQuery .= " and Sex LIKE '%".$_GET["txtKeyword3"]."%' ";
	}	
	if($_GET["txtKeyword4"] != ""){
		$objQuery .= " and  Age LIKE '%".$_GET["txtKeyword4"]."%' ";
	}
}
	$objQuery = mssql_query($objQuery) or die ("Error Query [".$objQuery."]");
	$Num_Rows = mssql_num_rows($objQuery);


มัน eror อีกแล้วครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-09-12 18:21:16 By : วันพีช
 


 

No. 2



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



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


ผมลองแก้ไหม่

Code (PHP)
$objQuery = "SELECT  * FROM  Member WHERE (IDCard LIKE '%".$_GET["txtKeyword2"]."%' 
																  
 and  Sex LIKE '%".$_GET["txtKeyword3"]."%' 
																   
and  Age LIKE '%".$_GET["txtKeyword4"]."%'
																  
and  District LIKE '%".$_GET["txtKeyword5"]."%'
																   
and  Education LIKE '%".$_GET["txtKeyword6"]."%'
																   
and  Occuption LIKE '%".$_GET["txtKeyword7"]."%'
																    
and  Income >= '$txtKeyword8' and Income <= '$txtKeyword9')";




มันยัง search ไม่ออกครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-09-13 17:05:35 By : วันพีช
 

 

No. 3



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



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


ทำได้แล้วครับ

$objQuery = "SELECT * FROM Member WHERE (NumberCard LIKE '%".$_GET["txtKeyword1"]."%'

and IDCard LIKE '%".$_GET["txtKeyword2"]."%'

and Sex LIKE '%".$_GET["txtKeyword3"]."%'

and District LIKE '%".$_GET["txtKeyword4"]."%'

and Education LIKE '%".$_GET["txtKeyword5"]."%'

nd Occuption LIKE '%".$_GET["txtKeyword6"]."%')";

if($_GET["txtKeyword7"] != "" or $_GET["txtKeyword8"] != ""){

$objQuery .= " and (Income between '".$_GET["txtKeyword7"]."' and '".$_GET["txtKeyword8"]."') ";
}

else if($_GET["txtKeyword9"] != "" or $_GET["txtKeyword10"] != ""){

$objQuery .= " and (Income between '".$_GET["txtKeyword9"]."' and '".$_GET["txtKeyword10"]."') ";
}

else if($_GET["txtKeyword11"] != "" or $_GET["txtKeyword12"] != ""){

$objQuery .= " and (Income between '".$_GET["txtKeyword11"]."' and '".$_GET["txtKeyword12"]."') ";
}
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-09-16 15:32:52 By : วันพีช
 


 

No. 4



โพสกระทู้ ( 2,311 )
บทความ ( 1 )



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



แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-09-16 15:35:53 By : arm8957
 


 

No. 5



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



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


แก้นิดนึง



$objQuery = "SELECT * FROM Member WHERE (NumberCard LIKE '%".$_GET["txtKeyword1"]."%'

and IDCard LIKE '%".$_GET["txtKeyword2"]."%'

and Sex LIKE '%".$_GET["txtKeyword3"]."%'

and District LIKE '%".$_GET["txtKeyword4"]."%'

and Education LIKE '%".$_GET["txtKeyword5"]."%'

and Occuption LIKE '%".$_GET["txtKeyword6"]."%')";

if($_GET["txtKeyword7"] != "" or $_GET["txtKeyword8"] != ""){

$objQuery .= " and (DateOfBrd between '".$_GET["txtKeyword7"]."' and '".$_GET["txtKeyword8"]."') ";

}

else if($_GET["txtKeyword9"] != "" or $_GET["txtKeyword10"] != ""){

$objQuery .= " and (Age between '".$_GET["txtKeyword9"]."' and '".$_GET["txtKeyword10"]."') ";

}

else if($_GET["txtKeyword11"] != "" or $_GET["txtKeyword12"] != ""){

$objQuery .= " and (Income between '".$_GET["txtKeyword11"]."' and '".$_GET["txtKeyword12"]."') ";

}
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-09-16 15:49:11 By : วันพีช
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ต้องการค้นเป็นข้อมูลระหว่าง between แต่ลองไส่ code ไปแล้วไม่ออกเลยครับ พวกพี่ๆๆช่วยแนะนำหน่อยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 03
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 อัตราราคา คลิกที่นี่