Home Search  Register
* * * * *
It is currently 24 Dec 2009, 19:21

All times are UTC + 7 hours



Welcome
Welcome to findfriend.freeforums.org | เว็บศูนย์รวมของเถื่อน.

คุณคือผู้ที่กำลังดูบอร์ดที่ยังไม่ได้ลงทะเบียนกับบอร์ดของเราในตอนนี้, ซึ่งให้การเข้าถึงที่จำกัดกับคุณ และเข้าถึงความสามารถอื่นๆของเราจะไม่เต็มที่. โดยการเข้าร่วมสมัครสมาชิกกับชุมชนที่ฟรีของเรา, คุณจะมีสิทธิการเข้าถึงสู่การโพสต์หัวข้อกระทู้ต่างๆ, ติดต่อกับสมาชิกอื่นๆโดยใช้กล่องข้อความส่วนตัว (PM), โต้ตอบเพื่อการสำรวจความนิยม, ส่งสิ่งที่บรรจุ, และเข้าถึงความสามารถพิเศษอื่นๆอีกมากมาย. การลงทะเบียนเร็วง่ายดาย, และอย่างสมบูรณ์แบบ ฟรี!, ฉะนั้นหากต้องการสิทธิการใช้งานที่มากกว่านี้กรุณาสมัครสมาชกกับเราก่อนนะครับผม คลิกเพื่อสมัครสมาชิก!


Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: โค๊ด Search engine แบบ มีเงื่อนไขมากกว่า1
PostPosted: 08 Feb 2008, 07:57 
Offline
ผู้ดูแลระบบ
User avatar

Joined: 07 Aug 2007, 10:50
Posts: 646
Location: in front of the future.
Highscores: 9
1. ========= ตัวอย่าง fileld ใน DB ===============
name class type zone
hackman Comsci Web Master zone-it
Karaged BC47 Programer zone-it
========end ===========================

2. File js.js
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest() {
createXMLHttpRequest();
var GN = document.getElementById("Gname").value;
var GC = document.getElementById("Gclass").value;
var GT = document.getElementById("Gtype").value;
var GZ= document.getElementById("Gzone").value;

xmlHttp.onreadystatechange = handleStateChange;
if (GN==0 || GC==0 || GT==0 || GZ==0)
{
alert ("เลือกเงื่อนไขด้วย!!");
return false;
}
xmlHttp.open("GET", "Research.php?gname=" + GN+"&gclass="+GC+"&gtype="+GT+"&gzone="+GZ, true);



xmlHttp.send(null);
}

function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
document.getElementById("TxtShowGraph").innerHTML = xmlHttp.responseText;
}
}
}

===================== end ==========================================

3. Form Search.php ======================================
<HTML>
<HEAD>
<TITLE>Test Search Query > 1 </TITLE>

</HEAD>

<BODY>

Name <INPUT TYPE="text" id="Gname">

Class <SELECT NAME="" id="Gclass">
<option> Choose</option>
<option value="Comsci">Comsci</option>
<option value="BC47">BC47</option>
</SELECT><BR>
Type <SELECT NAME="" id="Gtype">
<option> Choose</option>
<option value="Web Master">Web Master</option>
<option value="Programer">Programer</option>
</SELECT><BR>
Zone <SELECT NAME="" id="GZone">
<option> Choose</option>
<option value="zone-it">zone-it</option>
<option value="Comsci">comsci</option>
</SELECT>
<INPUT TYPE="button" onclick="startRequest()" value="Search">



<div id="TxtShowGraph"></div>
</BODY>
</HTML>
===================================end =============================

4. Research.php =======================================================
<?
include "config.php"; //file Connect
$s1=$_GET["gname"];
$s2=$_GET["gclass"];
$s3=$_GET["gtype"];
$s4=$_GET["gzone"];

$sql=mysql_query("select * from tbtest where name like '%$s1%' AND class='$s2' AND type='$s3' AND zone='$s4' ");
$num=mysql_num_rows($sql);
if ($num = 0) {
echo "Empty Data";
}else{
while ($r=mysql_fetch_array($sql)) {
$name=$r["name"];
$class=$r["class"];
$type=$r["type"];
$zone=$r["zone"];

echo "Name:= $name Class:=$class Type:=$type Zone:=$zone";
}
}
?>
=====================================end ======================================
=====================================end ProJect=================================

Image

thanks @ zone-it.com

_________________
The day After tomorrow
โปรดเข้าใจ...ไม่ใช่คนเก่ง...แต่อยากให้ทุกคนโง่เท่าเทียมกัน...{๑_๑}








....

Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 7 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: