|
|
|
ต้องการดึงข้อมูลจาก colum เดียวกันต้องดึงยังไงครับ |
|
|
|
|
|
|
|
Code (SQL)
select * from tbxxx where allergens in ('Histamine','Kapok')
|
|
|
|
|
Date :
2015-03-19 11:17:06 |
By :
ไม่ทราบแหล่งที่มา |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ต้องเห็นแบบฟอร์ม input ข้อมูลเข้ามา ในการจะทำการselect ครั้งนี้ก่อนครับถึงจะตอบได้
ถ้ายังไม่ออกแบบฟอร์ม input ก็ตอบได้นะ แต่มันจะไม่ถูกเพราะมีหลายวิธีมาก
ดังนั้นถ้าจะ SELECT อะไรซักอย่าง ที่มีการ WHERE (แบบหลากหลาย) เราต้องสร้างแบบฟอร์มก่อนครับ
ถึงจะออกแบบคิวรี่ได้
|
ประวัติการแก้ไข 2015-03-19 13:38:36
|
|
|
|
Date :
2015-03-19 13:37:42 |
By :
meannerss |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>สาขาวิชาโรคภูมิแพ้และอิมมูโนวิทยา </title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<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 language="JavaScript">
function lock()
{
document.getElementById('skintest').disabled = true;
document.getElementById('others').disabled = true;
document.getElementById('sl1').disabled = true;
document.getElementById('ch1').disabled = true;
document.getElementById('wheal1').disabled = true;
document.getElementById('skintest2').disabled = true;
document.getElementById('others2').disabled = true;
document.getElementById('sl2').disabled = true;
document.getElementById('ch2').disabled = true;
document.getElementById('wheal2').disabled = true;
document.getElementById('skintest3').disabled = true;
document.getElementById('others3').disabled = true;
document.getElementById('sl3').disabled = true;
document.getElementById('ch3').disabled = true;
document.getElementById('wheal3').disabled = true;
document.getElementById('skintest4').disabled = true;
document.getElementById('others4').disabled = true;
document.getElementById('sl4').disabled = true;
document.getElementById('ch4').disabled = true;
document.getElementById('wheal4').disabled = true;
//document.getElementById('other').readOnly = true;
/*document.getElementById('choise').disabled = true;
document.getElementById('choise1').disabled = true;
document.getElementById('choise2').disabled = true;*/
//document.getElementById('choise3').disabled = true;
//document.getElementById('choise4').disabled = true;
}
function skin()
{
if (document.getElementById('skintest').value=="other")
{
document.getElementById('others').readOnly = false;
document.getElementById('others').value = "";
}
else
{
document.getElementById('others').readOnly = true;
document.getElementById('others').value = document.getElementById('skintest').value;
}
}
function skin2()
{
if (document.getElementById('skintest2').value=="other")
{
document.getElementById('others2').readOnly = false;
document.getElementById('others2').value = "";
}
else
{
document.getElementById('others2').readOnly = true;
document.getElementById('others2').value = document.getElementById('skintest2').value;
}
}
function skin3()
{
if (document.getElementById('skintest3').value=="other")
{
document.getElementById('others3').readOnly = false;
document.getElementById('others3').value = "";
}
else
{
document.getElementById('others3').readOnly = true;
document.getElementById('others3').value = document.getElementById('skintest3').value;
}
}
function skin4()
{
if (document.getElementById('skintest4').value=="other")
{
document.getElementById('others4').readOnly = false;
document.getElementById('others4').value = "";
}
else
{
document.getElementById('others4').readOnly = true;
document.getElementById('others4').value = document.getElementById('skintest4').value;
}
}
function sym1()
{
if (document.getElementById('sl1').value=="yes")
{
document.getElementById('wheal1').readOnly = false;
document.getElementById('wheal1').value = "";
}
else
{
document.getElementById('wheal1').readOnly = true;
document.getElementById('wheal1').value = 0;
}
}
function sym2()
{
if (document.getElementById('sl2').value=="yes")
{
document.getElementById('wheal2').readOnly = false;
document.getElementById('wheal2').value = "";
}
else
{
document.getElementById('wheal2').readOnly = true;
document.getElementById('wheal2').value = 0;
}
}
function sym3()
{
if (document.getElementById('sl3').value=="yes")
{
document.getElementById('wheal3').readOnly = false;
document.getElementById('wheal3').value = "";
}
else
{
document.getElementById('wheal3').readOnly = true;
document.getElementById('wheal3').value = 0;
}
}
function sym4()
{
if (document.getElementById('sl4').value=="yes")
{
document.getElementById('wheal4').readOnly = false;
document.getElementById('wheal4').value = "";
}
else
{
document.getElementById('wheal4').readOnly = true;
document.getElementById('wheal4').value = 0;
}
}
function lockskin()
{
if (document.getElementById('skinpick').value=="no")
{
document.getElementById('skintest').disabled = true;
document.getElementById('others').disabled = true;
document.getElementById('sl1').disabled = true;
document.getElementById('ch1').disabled = true;
document.getElementById('wheal1').disabled = true;
document.getElementById('skintest2').disabled = true;
document.getElementById('others2').disabled = true;
document.getElementById('sl2').disabled = true;
document.getElementById('ch2').disabled = true;
document.getElementById('wheal2').disabled = true;
document.getElementById('skintest3').disabled = true;
document.getElementById('others3').disabled = true;
document.getElementById('sl3').disabled = true;
document.getElementById('ch3').disabled = true;
document.getElementById('wheal3').disabled = true;
document.getElementById('skintest4').disabled = true;
document.getElementById('others4').disabled = true;
document.getElementById('sl4').disabled = true;
document.getElementById('ch4').disabled = true;
document.getElementById('wheal4').disabled = true;
}
else
{
document.getElementById('skintest').disabled = false;
document.getElementById('others').disabled = false;
document.getElementById('sl1').disabled = false;
document.getElementById('ch1').disabled = false;
document.getElementById('wheal1').disabled = false;
document.getElementById('skintest2').disabled = false;
document.getElementById('others2').disabled = false;
document.getElementById('sl2').disabled = false;
document.getElementById('ch2').disabled = false;
document.getElementById('wheal2').disabled = false;
document.getElementById('skintest3').disabled = false;
document.getElementById('others3').disabled = false;
document.getElementById('sl3').disabled = false;
document.getElementById('ch3').disabled = false;
document.getElementById('wheal3').disabled = false;
document.getElementById('skintest4').disabled = false;
document.getElementById('others4').disabled = false;
document.getElementById('sl4').disabled = false;
document.getElementById('ch4').disabled = false;
document.getElementById('wheal4').disabled = false;
}
}
</script>
</head>
<body onload="Javascript:lock();">
<table border="0" align="center">
<tr>
<td align="center">
<img src="image/head.jpg" width="800" height="150" border="0" alt="">
</td>
</tr>
<tr>
<td>
<hr>
<div id="" class="">
<a href="immu.php">หน้าหลัก</a>
</div>
<form method="post" action="<?=$_SERVER["SCRIPT_NAME"]?>?search=skin">
<table>
<tr>
<td>ลักษณะอาการ : </td>
<td>
<select name="skinpick" id="skinpick" onchange="javascript:lockskin();">
<option value="" selected>กรุณาเลือก</option>
<option value="yes">มีอาการแพ้</option>
<option value="no">ไม่มีอาการแพ้</option>
</select>
</td>
</tr>
</table>
<table align="center" border="1">
<th colspan="2">Allergens</th>
<th colspan="2">ลักษณะอาการ</th>
<tr>
<td><input type="checkbox" name="ch1" id="ch1" value="1"></td>
<td>
<select name="skintest" id="skintest" onChange="JavaScript:skin();">
<option value="" selected>กรุณาเลือก</option>
<option value="Buffer Saline">Buffer Saline</option>
<option value="Histamine">Histamine</option>
<option value="Mite D.P.">Mite D.P.</option>
<option value="Mite D.F.">Mite D.F.</option>
<option value="Kapok">Kapok</option>
<option value="Cat">Cat</option>
<option value="Dog">Dog</option>
<option value="Mouse epithelium">Mouse epithelium</option>
<option value="Rat epithelia">Rat epithelia</option>
<option value="American cockroach">American cockroach</option>
<option value="German cockroach">German cockroach</option>
<option value="Bermuda grass">Bermuda grass</option>
<option value="John grass">John grass</option>
<option value="Careless weed">Careless weed</option>
<option value="Acacia">Acacia</option>
<option value="Penicillium">Penicillium</option>
<option value="Aspergillus">Aspergillus</option>
<option value="Alternalia">Alternalia</option>
<option value="other">อื่นๆ</option>
</select>
<input type="text" name="others" id="others">
</td>
<td align="center">
<select name="sl1" id="sl1" onchange="javascript:sym1();">
<option value="" selected>กรุณาเลือก</option>
<option value="yes">มีอาการแพ้</option>
<option value="no">ไม่มีอาการแพ้</option>
</select>
</td>
<td align="center">
<input type="text" name="wheal1" id="wheal1">
</td>
</tr>
<!-- /********* 2 **********/ -->
<tr>
<td><input type="checkbox" name="ch2" id="ch2" value="1"></td>
<td>
<select name="skintest2" id="skintest2" onChange="JavaScript:skin2();">
<option value="" selected>กรุณาเลือก</option>
<option value="Buffer Saline">Buffer Saline</option>
<option value="Histamine">Histamine</option>
<option value="Mite D.P.">Mite D.P.</option>
<option value="Mite D.F.">Mite D.F.</option>
<option value="Kapok">Kapok</option>
<option value="Cat">Cat</option>
<option value="Dog">Dog</option>
<option value="Mouse epithelium">Mouse epithelium</option>
<option value="Rat epithelia">Rat epithelia</option>
<option value="American cockroach">American cockroach</option>
<option value="German cockroach">German cockroach</option>
<option value="Bermuda grass">Bermuda grass</option>
<option value="John grass">John grass</option>
<option value="Careless weed">Careless weed</option>
<option value="Acacia">Acacia</option>
<option value="Penicillium">Penicillium</option>
<option value="Aspergillus">Aspergillus</option>
<option value="Alternalia">Alternalia</option>
<option value="other">อื่นๆ</option>
</select>
<input type="text" name="others2" id="others2">
</td>
<td align="center">
<select name="sl2" id="sl2" onchange="javascript:sym2();">
<option value="" selected>กรุณาเลือก</option>
<option value="yes">มีอาการแพ้</option>
<option value="no">ไม่มีอาการแพ้</option>
</select>
</td>
<td align="center">
<input type="text" name="wheal2" id="wheal2">
</td>
</tr>
<!-- /********* 3 **********/ -->
<tr>
<td><input type="checkbox" name="ch3" id="ch3" value="1"></td>
<td>
<select name="skintest3" id="skintest3" onChange="JavaScript:skin3();">
<option value="" selected>กรุณาเลือก</option>
<option value="Buffer Saline">Buffer Saline</option>
<option value="Histamine">Histamine</option>
<option value="Mite D.P.">Mite D.P.</option>
<option value="Mite D.F.">Mite D.F.</option>
<option value="Kapok">Kapok</option>
<option value="Cat">Cat</option>
<option value="Dog">Dog</option>
<option value="Mouse epithelium">Mouse epithelium</option>
<option value="Rat epithelia">Rat epithelia</option>
<option value="American cockroach">American cockroach</option>
<option value="German cockroach">German cockroach</option>
<option value="Bermuda grass">Bermuda grass</option>
<option value="John grass">John grass</option>
<option value="Careless weed">Careless weed</option>
<option value="Acacia">Acacia</option>
<option value="Penicillium">Penicillium</option>
<option value="Aspergillus">Aspergillus</option>
<option value="Alternalia">Alternalia</option>
<option value="other">อื่นๆ</option>
</select>
<input type="text" name="others3" id="others3">
</td>
<td align="center">
<select name="sl3" id="sl3" onchange="javascript:sym3();">
<option value="" selected>กรุณาเลือก</option>
<option value="yes">มีอาการแพ้</option>
<option value="no">ไม่มีอาการแพ้</option>
</select>
</td>
<td align="center">
<input type="text" name="wheal3" id="wheal3">
</td>
</tr>
<!-- /********* 4 **********/ -->
<tr>
<td><input type="checkbox" name="ch4" id="ch4" value="1"></td>
<td>
<select name="skintest4" id="skintest4" onChange="JavaScript:skin4();">
<option value="" selected>กรุณาเลือก</option>
<option value="Buffer Saline">Buffer Saline</option>
<option value="Histamine">Histamine</option>
<option value="Mite D.P.">Mite D.P.</option>
<option value="Mite D.F.">Mite D.F.</option>
<option value="Kapok">Kapok</option>
<option value="Cat">Cat</option>
<option value="Dog">Dog</option>
<option value="Mouse epithelium">Mouse epithelium</option>
<option value="Rat epithelia">Rat epithelia</option>
<option value="American cockroach">American cockroach</option>
<option value="German cockroach">German cockroach</option>
<option value="Bermuda grass">Bermuda grass</option>
<option value="John grass">John grass</option>
<option value="Careless weed">Careless weed</option>
<option value="Acacia">Acacia</option>
<option value="Penicillium">Penicillium</option>
<option value="Aspergillus">Aspergillus</option>
<option value="Alternalia">Alternalia</option>
<option value="other">อื่นๆ</option>
</select>
<input type="text" name="others4" id="others4">
</td>
<td align="center">
<select name="sl4" id="sl4" onchange="javascript:sym4();">
<option value="" selected>กรุณาเลือก</option>
<option value="yes">มีอาการแพ้</option>
<option value="no">ไม่มีอาการแพ้</option>
</select>
</td>
</td>
<td align="center">
<input type="text" name="wheal4" id="wheal4">
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" value="ค้นหา">
</tr>
</table>
</form>
รูปหน้า form ครับ
|
|
|
|
|
Date :
2015-03-19 15:13:44 |
By :
Clamore |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ที่ มีโครงสร้างเหมือนกัน ปรับมาใช้ตัวเดียวกันดีกว่าครับ
skin กับ sym ต้างกันแค่แค่ชื่อ
Code (JavaScript)
function skinsym1( nm1, nm2 )
{
if (document.getElementById(nm1).value=="yes")
{
document.getElementById(nm2).readOnly = false;
document.getElementById(nm2).value = "";
}
else
{
document.getElementById(nm2).readOnly = true;
document.getElementById(nm2).value = 0;
}
}
ลองประยุกต์ดูนะครับ ส่วนอย่างอื่นยังไม่ได้อ่านครับ เห็นแค่ฟังก์ชั่น ซ้ำๆ ก็บอกอันนี้ก่อน
|
|
|
|
|
Date :
2015-03-19 16:55:24 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|